MintDuino by de Vinck Marc

MintDuino by de Vinck Marc

Author:de Vinck, Marc...
Language: eng
Format: epub
Published: 2014-05-21T23:04:44.853000+00:00


Upload Your First Sketch

Now it’s time to upload the Subtask 1 program (sketch). You can download this sketch from http://examples.oreilly.com/0636920020882, or simply open your Arduino IDE and enter the following sketch/code:

// MintDuino NoteBook 1 – Subtask 1 int ledPin = 7; // Digital Pin 7 for LED anode connection int ledWaitMin = 2000; // Set minimum wait time to 2000 milliseconds void setup() { // use noise on pin 1 to generate a random number randomSeed(analogRead(1)); pinMode(ledPin, OUTPUT); } void loop() { // add random time of 0-5 seconds int ledWait = ledWaitMin + random(5000); // three fast blinks for (int count = 0; count < 3; count++) { digitalWrite(ledPin, HIGH); delay(250); digitalWrite(ledPin, LOW); delay(250); } delay(ledWait); // random amount of time passes digitalWrite(ledPin, HIGH); delay(2000); // wait 2 seconds after random lighting digitalWrite(ledPin, LOW); delay(5000); // wait 5 seconds before resetting }

Connect the FTDI Friend (or other FTDI adapter) to your MintDuino as seen in Figure 3-5. This connects your computer to the MintDuino so that you can upload the sketch. Remember that you’ll need to provide power to the MintDuino using the 9V battery!



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.