Matériel

  • un arduino (ici MEGA 2560) ou compatible avec sa liaison PC

Note :
Le but ici est juste de tester à minima sans autres que l'Arduino qu'il fonctionne.

Code :

Pour cela nous allons utiliser l'exemple fournit avec l'IDE, qui permet de faire clignoter la LED intégré à l'Arduino. Aller dans le menu Fichier, Exemples, 01.Basics, Blink , il ne reste plus qu'à vérifier la compilation et téléverser le code dans l'Arduino.

 1 /
 2   Blink
 3   Turns on an LED on for one second, then off for one second, repeatedly.
 4 
 5   Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO 
 6   it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN takes care 
 7   of use the correct LED pin whatever is the board used.
 8   If you want to know what pin the on-board LED is connected to on your Arduino model, check
 9   the Technical Specs of your board  at https://www.arduino.cc/en/Main/Products
10 
11 This example code is in the public domain. 12 13 modified 8 May 2014 14 by Scott Fitzgerald 15
16 modified 2 Sep 2016 17 by Arturo Guadalupi 18
/ 19 20 21 // the setup function runs once when you press reset or power the board 22 void setup() { 23 // initialize digital pin LED_BUILTIN as an output. 24 pinMode(LED_BUILTIN, OUTPUT); 25 } 26 27 // the loop function runs over and over again forever 28 void loop() { 29 digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) 30 delay(1000); // wait for a second 31 digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW 32 delay(1000); // wait for a second 33 }

Résultat :

Vous devriez voir la LED intégré (à côté du port 13) clignoté toutes les secondes.