| Electronic Components Datasheet Search |
|
DEV-12887 Datasheet(PDF) 16 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-12887 Datasheet(HTML) 16 Page - SparkFun Electronics |
|
16 / 40 page ![]() /* Hello, Blink by: Jim Lindblom SparkFun Electronics date: October 31, 2013 license: Beerware. Use, reuse, and modify this code howeve r you see fit. If you find it useful, buy me a beer some day! This is an Electric Imp hello, world blink sketch. It'll bl ink an LED connected to pin 1, once every second. */ //////////////////////////////////////// // Global Variables // //////////////////////////////////////// ledState < 0; //////////////////////////////////////// // Function definitions // //////////////////////////////////////// // Loop constantly updates the LED. If ledState is 1, we'll tu rn the LED on and // set ledState to 0. Viceversa is ledState is 0 coming in. T his function // schedules a wakeup in 1 second, and calls itself again. function loop() { if (ledState) { hardware.pin1.write(1); // Write pin 1 high ledState =0; // Flip ledState } else { hardware.pin1.write(0); // Write pin 1 low ledState =1; // Flip ledState } // This must be called at the end. This'll call loop() aga in in 1s, that way // it'll actually loop! imp.wakeup(1.00, loop); } //////////////////////////////////////// // Setup Stuff: Runs first at startup // //////////////////////////////////////// hardware.pin1.configure(DIGITAL_OUT); // Configure Pin 1 as digital output loop(); // Call loop, and let the program go! Then hit the >Build and Run button up top, and enjoy the blinks. Shortcut heads up! If you’re a neurotic CTRL+S saver, the standard save shortcut does save, but it also attempts to build and run your code. If successful, it’ll upload the code and immediately start running on your imp. If there’s an error, you’ll start hearing about it in the log window. Into the Code Page 16 of 40 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |