diff --git a/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp new file mode 100644 index 000000000..3dc24b85d --- /dev/null +++ b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp @@ -0,0 +1,56 @@ + + + +// these constants won't change: +#include "WProgram.h" +void setup(); +void loop(); +const int analogPin = 0; // the pin that the potentiometer is attached to +const int ledCount = 10; // the number of LEDs in the bar graph + +int ledPins[] = { + 2, 3, 4, 5, 6, 7,8,9,10,11 }; // an array of pin numbers to which LEDs are attached + + +void setup() { + // loop over the pin array and set them all to output: + for (int thisLed = 0; thisLed < ledCount; thisLed++) { + pinMode(ledPins[thisLed], OUTPUT); + } +} + +void loop() { + // read the potentiometer: + int sensorReading = analogRead(analogPin); + // map the result to a range from 0 to the number of LEDs: + int ledLevel = map(sensorReading, 0, 1023, 0, ledCount); + + // loop over the LED array: + for (int thisLed = 0; thisLed < ledCount; thisLed++) { + // if the array element's index is less than ledLevel, + // turn the pin for this element on: + if (thisLed < ledLevel) { + digitalWrite(ledPins[thisLed], HIGH); + } + // turn off all pins higher than the ledLevel: + else { + digitalWrite(ledPins[thisLed], LOW); + } + } +} + + + + +int main(void) +{ + init(); + + setup(); + + for (;;) + loop(); + + return 0; +} + diff --git a/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.eep b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.eep new file mode 100644 index 000000000..1996e8fde --- /dev/null +++ b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.elf b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.elf new file mode 100755 index 000000000..33960d620 Binary files /dev/null and b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.elf differ diff --git a/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.hex b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.hex new file mode 100644 index 000000000..11ac9affc --- /dev/null +++ b/build/shared/dist/examples/Display/barGraph/applet/barGraph.cpp.hex @@ -0,0 +1,87 @@ +:100000000C9461000C947E000C947E000C947E0095 +:100010000C947E000C947E000C947E000C947E0068 +:100020000C947E000C947E000C947E000C947E0058 +:100030000C947E000C947E000C947E000C947E0048 +:100040000C94E9000C947E000C947E000C947E00CD +:100050000C947E000C947E000C947E000C947E0028 +:100060000C947E000C947E00000000002400270009 +:100070002A0000000000250028002B0000000000DE +:1000800023002600290004040404040404040202DA +:100090000202020203030303030301020408102007 +:1000A0004080010204081020010204081020000012 +:1000B0000007000201000003040600000000000029 +:1000C000000011241FBECFEFD4E0DEBFCDBF11E092 +:1000D000A0E0B1E0EAE3F5E002C005900D92A631A0 +:1000E000B107D9F711E0A6E1B1E001C01D92AF312F +:1000F000B107E1F70E94E2000C949B020C9400000F +:10010000AF92BF92CF92DF92EF92FF920F931F9325 +:10011000CF93DF9380E00E946B0100D000D0AA272C +:1001200097FDA095BA2F2AE030E040E050E0EDB70F +:10013000FEB72183328343835483BC01CD0120E089 +:1001400030E040E050E0EFEFEE2EE3E0FE2E012D38 +:10015000112DAA24BB2465010E94F6017B01C0E099 +:10016000D1E000E010E00F900F900F900F900E156F +:100170001F051CF4888161E002C0888160E00E9454 +:10018000A9010F5F1F4F22960A30110581F7DF91F9 +:10019000CF911F910F91FF90EF90DF90CF90BF9084 +:1001A000AF900895CF93DF93C0E0D1E0888161E004 +:1001B0000E948901229681E0C431D807B9F7DF9106 +:1001C000CF9108950E9431010E94D2000E948000C8 +:1001D000FDCF1F920F920FB60F9211242F933F93D2 +:1001E0008F939F93AF93BF9380911A0190911B01BE +:1001F000A0911C01B0911D0130911E010196A11D1D +:10020000B11D232F2D5F2D3720F02D570196A11DF5 +:10021000B11D20931E0180931A0190931B01A0939E +:100220001C01B0931D018091160190911701A091BE +:100230001801B09119010196A11DB11D80931601FD +:1002400090931701A0931801B0931901BF91AF913A +:100250009F918F913F912F910F900FBE0F901F9004 +:100260001895789484B5826084BD84B5816084BD1E +:1002700085B5826085BD85B5816085BDEEE6F0E01F +:10028000808181608083E1E8F0E08081826080830A +:10029000808181608083E0E8F0E0808181608083FC +:1002A000E1EBF0E0808184608083E0EBF0E080812E +:1002B00081608083EAE7F0E08081846080838081D0 +:1002C0008260808380818160808380818068808378 +:1002D0001092C10008958770909114019295990F22 +:1002E000990F907C982B90937C0080917A00806489 +:1002F00080937A0080917A0086FDFCCF209178006F +:1003000040917900942F80E030E0282B392BC901EF +:100310000895282F30E0C90186569F4FFC01949123 +:100320002A573F4FF9018491882391F0E82FF0E09C +:10033000EE0FFF1FE859FF4FA591B491662329F4F2 +:100340008C91909589238C9308958C91892B8C9313 +:100350000895482F50E0CA0182559F4FFC01249117 +:10036000CA0186569F4FFC0194914A575F4FFA018C +:1003700034913323D1F1222331F1233021F48091C0 +:1003800080008F7705C0243031F4809180008F7D0C +:100390008093800018C0213019F484B58F7704C091 +:1003A000223021F484B58F7D84BD0DC0263021F428 +:1003B0008091B0008F7705C0273029F48091B0007C +:1003C0008F7D8093B000E32FF0E0EE0FFF1FEE581B +:1003D000FF4FA591B491662329F48C9190958923C0 +:1003E0008C9308958C91892B8C9308952F923F9232 +:1003F0004F925F926F927F928F929F92AF92BF9235 +:10040000CF92DF92EF92FF920F931F93DF93CF93E0 +:10041000CDB7DEB73B014C0119012A016D897E89F8 +:100420008F89988D6A197B098C099D09621A730A54 +:10043000840A950AA40193010E943F02E218F3087E +:1004400004091509A80197010E945E022A0D3B1DAF +:100450004C1D5D1DB901CA01CF91DF911F910F9114 +:10046000FF90EF90DF90CF90BF90AF909F908F90D4 +:100470007F906F905F904F903F902F900895629F74 +:10048000D001739FF001829FE00DF11D649FE00D8C +:10049000F11D929FF00D839FF00D749FF00D659FED +:1004A000F00D9927729FB00DE11DF91F639FB00DEC +:1004B000E11DF91FBD01CF011124089597FB092EFD +:1004C00005260ED057FD04D014D00AD0001C38F4F5 +:1004D00050954095309521953F4F4F4F5F4F089570 +:1004E000F6F790958095709561957F4F8F4F9F4F50 +:1004F0000895A1E21A2EAA1BBB1BFD010DC0AA1F65 +:10050000BB1FEE1FFF1FA217B307E407F50720F07C +:10051000A21BB30BE40BF50B661F771F881F991FF7 +:100520001A9469F760957095809590959B01AC0140 +:0A053000BD01CF010895F894FFCF3C +:10053A000200030004000500060007000800090085 +:06054A000A000B00010095 +:00000001FF diff --git a/build/shared/dist/examples/Display/barGraph/applet/core.a b/build/shared/dist/examples/Display/barGraph/applet/core.a new file mode 100644 index 000000000..2d98033b2 Binary files /dev/null and b/build/shared/dist/examples/Display/barGraph/applet/core.a differ diff --git a/build/shared/dist/examples/Display/barGraph/barGraph.pde b/build/shared/dist/examples/Display/barGraph/barGraph.pde new file mode 100644 index 000000000..3e6664a1d --- /dev/null +++ b/build/shared/dist/examples/Display/barGraph/barGraph.pde @@ -0,0 +1,58 @@ +/* + LED bar graph + + Turns on a series of LEDs based on the value of an analog sensor. + This is a simple way to make a bar graph display. Though this graph + uses 10 LEDs, you can use any number by changing the LED count + and the pins in the array. + + This method can be used to control any series of digital outputs that + depends on an analog input. + + The circuit: + * LEDs from pins 2 through 11 to ground + + created 26 Jun 2009 + by Tom Igoe + + http://www.arduino.cc/en/Tutorial/BarGraph + */ + + +// these constants won't change: +const int analogPin = 0; // the pin that the potentiometer is attached to +const int ledCount = 10; // the number of LEDs in the bar graph + +int ledPins[] = { + 2, 3, 4, 5, 6, 7,8,9,10,11 }; // an array of pin numbers to which LEDs are attached + + +void setup() { + // loop over the pin array and set them all to output: + for (int thisLed = 0; thisLed < ledCount; thisLed++) { + pinMode(ledPins[thisLed], OUTPUT); + } +} + +void loop() { + // read the potentiometer: + int sensorReading = analogRead(analogPin); + // map the result to a range from 0 to the number of LEDs: + int ledLevel = map(sensorReading, 0, 1023, 0, ledCount); + + // loop over the LED array: + for (int thisLed = 0; thisLed < ledCount; thisLed++) { + // if the array element's index is less than ledLevel, + // turn the pin for this element on: + if (thisLed < ledLevel) { + digitalWrite(ledPins[thisLed], HIGH); + } + // turn off all pins higher than the ledLevel: + else { + digitalWrite(ledPins[thisLed], LOW); + } + } +} + + +