Arduino: Difference between revisions

imported>Clerie
No edit summary
Railwhale (talk | contribs)
m tidy and add package links
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The Arduino ecosystem offers two Versions of the Arduino IDE and an Arduino CLI that both base on.
The Arduino ecosystem offers two Versions of the Arduino IDE and an Arduino CLI that both base on.
The latter can be used for building Arduino projects with nix.
The latter can be used for building Arduino projects with nix.
Line 5: Line 4:
== Arduino IDE 2.x ==
== Arduino IDE 2.x ==


The Arduino IDE 2.x is available in nixpkgs as <code>arduino-ide</code>
The Arduino IDE 2.x is available in nixpkgs as {{nixos:package|arduino-ide}}
 
When trying to upload to your board, you may get the following error:
 
<code>
Cannot perform port reset: 1200-bps touch: opening port at 1200bps: Permission denied
No device found on ttyACM0
</code>
 
This is a serial port permissions issue. Add your user to the <code>dialout</code> group, rebuild your system, then log out and back in or reboot to apply:
 
<syntaxhighlight lang="nix">
{
  users.users.<myuser>.extraGroups = [ "dialout" ];
}
</syntaxhighlight>


== Arduino IDE 1.x ==
== Arduino IDE 1.x ==


This is the old Arduino IDE and it is available as <code>arduino</code> in nixpkgs.
This is the old Arduino IDE and it is available as {{nixos:package|arduino}} in nixpkgs.
It is still used for many projects.
It is still used for many projects.


=== shell.nix ===
=== shell.nix ===


<syntaxHighlight lang=nix>
<syntaxhighlight lang="nix">
{ pkgs ? import <nixpkgs> {} }:
{
 
  pkgs ? import <nixpkgs> { },
with pkgs;
}:
 
pkgs.callPackage (
mkShell {
  {
  buildInputs = [
    mkShell,
    arduino
    arduino,
     #gnumake # upload with Makefile
  }:
    #screen # serial console
  mkShell {
   ];
    strictDeps = true;
}
    nativeBuildInputs = [
</syntaxHighlight>
      arduino
     ];
   }
) { }
</syntaxhighlight>


=== Upload program ===
=== Upload program ===
Line 77: Line 95:
== Arduino CLI ==
== Arduino CLI ==


The Arduino CLI is available as <code>arduino-cli</code> in nixpkgs.
The Arduino CLI is available as {{nixos:package|arduino-cli}} in nixpkgs.


=== Build Arduino project with Nix ===
=== Build Arduino project with Nix ===
Line 105: Line 123:


* [[Embedded]]
* [[Embedded]]
** [https://discourse.nixos.org/t/arduino-ide-environment/2086 shell.nix for Arduino IDE]
* [https://discourse.nixos.org/t/arduino-ide-environment/2086 shell.nix for Arduino IDE]
* https://wiki.archlinux.org/title/Arduino
* [https://wiki.archlinux.org/title/Arduino Arduino on archlinux wiki]
* https://github.com/boredom101/nixduino
* [https://github.com/boredom101/nixduino nixduino]
* https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
* [https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink Blink example]
* https://vid.bina.me/tools/arduino/arduino-on-nixos/
* [https://vid.bina.me/tools/arduino/arduino-on-nixos/ Arduino on NixOS]
* [https://gist.github.com/CMCDragonkai/d00201ec143c9f749fc49533034e5009 Arduino Connection on NixOS]
* [https://gist.github.com/CMCDragonkai/d00201ec143c9f749fc49533034e5009 Arduino Connection on NixOS]
* https://rzetterberg.github.io/teensy-development-on-nixos.html
* [https://rzetterberg.github.io/teensy-development-on-nixos.html Teensy development on NixOS]
 
 
[[Category:Development]]
[[Category:Applications]]
[[Category:IDE]]