Spark.IO-Build-FirstFlash

De MCHobby - Wiki
Révision datée du 8 décembre 2014 à 09:34 par Admin (discussion | contributions) (Page créée avec « {{Spark.IO-Build-NAV}} == Un bout de code == {{bloc-etroit|text=The best way to get started with the IDE is to start writing code: * Connect: Make sure your Core is powered... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Un bout de code

The best way to get started with the IDE is to start writing code:

  • Connect: Make sure your Core is powered and "breathing" Cyan, which indicates that it's connected to the Spark Cloud and ready to be updated.
  • Get Code: Try clicking on the "Blink an LED" example under the "Example apps" header. The Spark Build editor should display the code for the example application in an active tab. Alternatively, you can copy and paste this snippet of code into a new application in the Build IDE.
//D7 LED Flash Example
int LED = D7;

void setup() {
    pinMode(LED, OUTPUT);
}

void loop() {
    digitalWrite(LED, HIGH);
    delay(1000);
    digitalWrite(LED, LOW);
    delay(1000);
}

Votre Core & Flasher

Spark.IO-Build-WebIde-30.png
Crédit: Particle.IO www.particle.io

  • Select Your Core: The next step is to make sure that you've selected which of your Cores to flash code to. Click on the "Cores" icon at the bottom left side of the navigation pane, and click on the star next to the Core you'd like to update. Once you've selected a Core, the star associated with it will turn yellow. (If you only have one core, there is no need to select it, you can continue on to the next step).
  • Flash: Click the "Flash" button, and your code will be sent wirelessly to your Core. If the flash was successful, the LED on your Core will begin flashing magenta.

Fork & modification

Spark.IO-Build-WebIde-31.png
Crédit: Particle.IO www.particle.io

Un fork, ou embranchement, est un nouveau logiciel créé à partir du code source d'un logiciel existant. (cfr Wikipedia.fr)

  • Fork: Wish the timing of that LED flash was a little bit faster? Try clicking on the "Fork This Example" button after selecting the "Blink An LED" example application. You've now got a personal copy of that application that you can modify, save, and flash to all of your Cores.
  • Edit: Try changing the values in the delay() function from 1000 to 250, which changes the timing interval from 1000 milliseconds to only 250 milliseconds. Click the Verify button, then the Flash button. Is your Core's LED blinking faster? Well done :)