mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
Removing applet/ directories from the examples.
This commit is contained in:
parent
5dda367b06
commit
a81628675d
@ -1,86 +0,0 @@
|
||||
/*
|
||||
Conditionals - while statement
|
||||
|
||||
This example demonstrates the use of while() statements.
|
||||
|
||||
It reads the state of a potentiometer (an analog input) and blinks an LED
|
||||
while the LED remains above a certain threshold level. It prints the analog value
|
||||
only if it's below the threshold.
|
||||
|
||||
This example uses principles explained in the BlinkWithoutDelay example as well.
|
||||
|
||||
The circuit:
|
||||
* potentiometer connected to analog pin 0.
|
||||
Center pin of the potentiometer goes to the analog pin.
|
||||
side pins of the potentiometer go to +5V and ground
|
||||
* LED connected from digital pin 13 to ground
|
||||
|
||||
* Note: On most Arduino boards, there is already an LED on the board
|
||||
connected to pin 13, so you don't need any extra components for this example.
|
||||
|
||||
created 17 Jan 2009
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
|
||||
#define ledPin 13 // the pin for the LED
|
||||
#define analogPin 0 // the analog pin that the potentiometer is attached to
|
||||
|
||||
#include "WProgram.h"
|
||||
void setup();
|
||||
void loop();
|
||||
int threshold = 400; // an arbitrary threshold level that's in the range of the analog input
|
||||
int ledState = LOW; // the state of the LED
|
||||
int lastBlinkTime = 0; // last time the LED changed
|
||||
int blinkDelay = 500; // how long to hold between changes of the LED
|
||||
int analogValue; // variable to hold the value of the analog input
|
||||
void setup() {
|
||||
// initialize the LED pin as an output:
|
||||
pinMode(ledPin, OUTPUT);
|
||||
// initialize serial communications:
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the value of the potentiometer:
|
||||
analogValue = analogRead(analogPin);
|
||||
|
||||
// if the analog value is high enough, turn on the LED:
|
||||
while (analogValue > threshold) {
|
||||
// if enough time has passed since the last change of the LED,
|
||||
// then change it. Note you're using the technique from BlinkWithoutDelay
|
||||
// here so that the while loop doesn't delay the rest of the program:
|
||||
|
||||
if (millis() - lastBlinkTime > blinkDelay) {
|
||||
// if the ledState is high, this makes it low, and vice versa:
|
||||
ledState = !ledState;
|
||||
digitalWrite(ledPin, ledState);
|
||||
|
||||
// save the last time the LED changed in a variable:
|
||||
lastBlinkTime = millis();
|
||||
}
|
||||
// while you're in the while loop, you have to read the
|
||||
// input again:
|
||||
analogValue = analogRead(analogPin);
|
||||
}
|
||||
|
||||
// if you're below the threshold, print the analog value:
|
||||
Serial.println(analogValue, DEC);
|
||||
// turn the LED off:
|
||||
digitalWrite(ledPin, LOW);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
:00000001FF
|
Binary file not shown.
@ -1,155 +0,0 @@
|
||||
:100000000C9462000C94DC020C94F9020C948A00AB
|
||||
:100010000C948A000C948A000C948A000C948A0038
|
||||
:100020000C948A000C948A000C948A000C948A0028
|
||||
:100030000C948A000C948A000C948A000C948A0018
|
||||
:100040000C9416030C948A000C94F6000C948A000D
|
||||
:100050000C948A000C948A000C948A000C948A00F8
|
||||
:100060000C948A000C948A000000000024002700F1
|
||||
:100070002A0000000000250028002B0000000000DE
|
||||
:1000800023002600290004040404040404040202DA
|
||||
:100090000202020203030303030301020408102007
|
||||
:1000A0004080010204081020010204081020000012
|
||||
:1000B0000007000201000003040600000000000029
|
||||
:1000C0000000AF0111241FBECFEFD4E0DEBFCDBFD3
|
||||
:1000D00011E0A0E0B1E0EAE8F9E002C005900D927D
|
||||
:1000E000AC30B107D9F711E0ACE0B1E001C01D922E
|
||||
:1000F000A83BB107E1F710E0C4ECD0E004C02297C0
|
||||
:10010000FE010E94BF04C23CD107C9F70E94EF0064
|
||||
:100110000C94C3040C94000032C00E94860320910A
|
||||
:100120000E0130910F01442737FD4095542F621B7B
|
||||
:10013000730B840B950B209102013091030144272E
|
||||
:1001400037FD4095542F2617370748075907B8F44D
|
||||
:1001500060E070E080910C0190910D01892B11F409
|
||||
:1001600061E070E070930D0160930C018DE00E94DE
|
||||
:100170000C040E94860370930F0160930E0180E0CF
|
||||
:100180000E94CE03909311018093100120911001E1
|
||||
:100190003091110180910001909101018217930724
|
||||
:1001A0000CF4BBCFA901662757FD6095762F2AE096
|
||||
:1001B00030E086E991E00E94D10260E08DE00E948B
|
||||
:1001C0000C04089561E08DE00E94EC0340E855E2E4
|
||||
:1001D00060E070E086E991E00E94330108950E949A
|
||||
:1001E00094030E94E2000E948C00FDCF1F920F92A8
|
||||
:1001F0000FB60F9211242F933F934F935F936F93FA
|
||||
:100200007F938F939F93AF93BF93EF93FF9340910F
|
||||
:10021000C600E0919201F0919301CF01019660E850
|
||||
:1002200070E00E9459049C01809194019091950185
|
||||
:100230002817390739F0EE5EFE4F40833093930163
|
||||
:1002400020939201FF91EF91BF91AF919F918F9178
|
||||
:100250007F916F915F914F913F912F910F900FBEC2
|
||||
:100260000F901F901895AF92BF92CF92DF92EF92AE
|
||||
:10027000FF920F931F93CF93DF936C017A018B0151
|
||||
:10028000DC011496AD90BC901597CB01BA0122E029
|
||||
:1002900030E040E050E00E948E04205C3D4B404F37
|
||||
:1002A0005F4FCA01B901A80197010E948E04C901DC
|
||||
:1002B000DA010197A109B109292F3A2F4B2F5527B0
|
||||
:1002C00047FD5A950196A11DB11DE5012883E60160
|
||||
:1002D000EE81FF8181508083EA85FB85208141E0AA
|
||||
:1002E00050E0CA010E8402C0880F991F0A94E2F7F9
|
||||
:1002F000282B2083EA85FB852081CA010F8402C058
|
||||
:10030000880F991F0A94E2F7282B2083EA85FB8542
|
||||
:100310008081088802C0440F551F0A94E2F7842B9D
|
||||
:100320008083DF91CF911F910F91FF90EF90DF902D
|
||||
:10033000CF90BF90AF900895FC01A085B185218931
|
||||
:100340008C9190E0022E02C0959587950A94E2F771
|
||||
:1003500080FFF6CF0484F585E02D6083089589E061
|
||||
:1003600091E0909397018093960182E191E09093C0
|
||||
:1003700099018093980185EC90E090939B01809384
|
||||
:100380009A0184EC90E090939D0180939C0180EC15
|
||||
:1003900090E090939F0180939E0181EC90E0909378
|
||||
:1003A000A1018093A00186EC90E09093A30180933B
|
||||
:1003B000A20184E08093A40183E08093A50187E0FB
|
||||
:1003C0008093A60185E08093A70108950F931F9362
|
||||
:1003D0008C01DC01ED91FC910190F081E02D6DE04C
|
||||
:1003E0000995D801ED91FC910190F081E02D6AE032
|
||||
:1003F000C80109951F910F9108952F923F924F9236
|
||||
:100400005F926F927F928F929F92AF92BF92CF92A4
|
||||
:10041000DF92EF92FF920F931F93DF93CF93CDB7AD
|
||||
:10042000DEB7A0970FB6F894DEBF0FBECDBF1C019C
|
||||
:100430006A017B01411551056105710549F4DC0133
|
||||
:10044000ED91FC910190F081E02D60E3099554C09D
|
||||
:10045000882499245401422E55246624772401E0EF
|
||||
:1004600010E00C0F1D1F080D191DC701B601A301D7
|
||||
:1004700092010E946C04F80160830894811C911C15
|
||||
:10048000A11CB11CC701B601A30192010E946C041A
|
||||
:10049000C901DA016C017D01C114D104E104F10448
|
||||
:1004A000F1F681E0E82EF12CEC0EFD1EE80CF91CB3
|
||||
:1004B0003E010894611C711CD501C4010197A1097A
|
||||
:1004C000B1096C01C818D90814C0F601EE0DFF1D62
|
||||
:1004D00060816A3010F4605D01C0695CD101ED910A
|
||||
:1004E000FC910190F081E02DC10109950894E1088B
|
||||
:1004F000F1086E147F0449F7A0960FB6F894DEBF9A
|
||||
:100500000FBECDBFCF91DF911F910F91FF90EF9064
|
||||
:10051000DF90CF90BF90AF909F908F907F906F9023
|
||||
:100520005F904F903F902F900895EF92FF920F931E
|
||||
:100530001F93CF93DF93EC017A018B0177FF0FC0FC
|
||||
:10054000E881F9810190F081E02D6DE20995109527
|
||||
:100550000095F094E094E11CF11C011D111D2AE0AE
|
||||
:10056000B801A701CE010E94FD01DF91CF911F913B
|
||||
:100570000F91FF90EF900895DC012115310541F4B2
|
||||
:10058000ED91FC910190F081E02D642F0995089583
|
||||
:100590002A30310519F40E94950208950E94FD0148
|
||||
:1005A00008950F931F938C010E94BC02C8010E9402
|
||||
:1005B000E6011F910F9108951F920F920FB60F92AF
|
||||
:1005C00011248F939F93EF93FF938091A8019091B3
|
||||
:1005D000A901892B29F0E091A801F091A9010995C1
|
||||
:1005E000FF91EF919F918F910F900FBE0F901F90F1
|
||||
:1005F00018951F920F920FB60F9211248F939F930D
|
||||
:10060000EF93FF938091AA019091AB01892B29F080
|
||||
:10061000E091AA01F091AB010995FF91EF919F91B3
|
||||
:100620008F910F900FBE0F901F9018951F920F92F1
|
||||
:100630000FB60F9211242F938F939F93AF93BF9375
|
||||
:100640008091AC019091AD01A091AE01B091AF014C
|
||||
:100650000196A11DB11D8093AC019093AD01A093B3
|
||||
:10066000AE01B093AF018091B0019091B101A09122
|
||||
:10067000B201B091B3018050904CAF4FBF4F809307
|
||||
:10068000B0019093B101A093B201B093B30127C020
|
||||
:100690008091B0019091B101A091B201B091B301EC
|
||||
:1006A00080589E43A040B0408093B0019093B10128
|
||||
:1006B000A093B201B093B3018091B4019091B501C0
|
||||
:1006C000A091B601B091B7010196A11DB11D809313
|
||||
:1006D000B4019093B501A093B601B093B701809196
|
||||
:1006E000B0019091B101A091B201B091B3018158D4
|
||||
:1006F0009E43A040B04060F6BF91AF919F918F9113
|
||||
:100700002F910F900FBE0F901F9018958FB7F894F0
|
||||
:100710002091B4013091B5014091B6015091B701DB
|
||||
:100720008FBFB901CA010895789484B5826084BDF1
|
||||
:1007300084B5816084BD85B5826085BD85B58160E5
|
||||
:1007400085BDEEE6F0E0808181608083E1E8F0E045
|
||||
:10075000808182608083808181608083E0E8F0E036
|
||||
:10076000808181608083E1EBF0E080818460808320
|
||||
:10077000E0EBF0E0808181608083EAE7F0E0808157
|
||||
:1007800084608083808182608083808181608083B7
|
||||
:100790008081806880831092C10008958770909155
|
||||
:1007A00004019295990F990F907C982B90937C005F
|
||||
:1007B00080917A00806480937A0080917A0086FD2F
|
||||
:1007C000FCCF2091780040917900942F80E030E0B8
|
||||
:1007D000282B392BC9010895282F30E0C9018656EE
|
||||
:1007E0009F4FFC0194912A573F4FF9018491882330
|
||||
:1007F00091F0E82FF0E0EE0FFF1FE859FF4FA591B1
|
||||
:10080000B491662329F48C91909589238C93089553
|
||||
:100810008C91892B8C930895482F50E0CA01825502
|
||||
:100820009F4FFC012491CA0186569F4FFC01949171
|
||||
:100830004A575F4FFA0134913323D1F1222331F12A
|
||||
:10084000233021F4809180008F7705C0243031F46B
|
||||
:10085000809180008F7D8093800018C0213019F432
|
||||
:1008600084B58F7704C0223021F484B58F7D84BD98
|
||||
:100870000DC0263021F48091B0008F7705C027305D
|
||||
:1008800029F48091B0008F7D8093B000E32FF0E0D9
|
||||
:10089000EE0FFF1FEE58FF4FA591B491662329F488
|
||||
:1008A0008C91909589238C9308958C91892B8C93AE
|
||||
:1008B000089597FB092E07260AD077FD04D049D06A
|
||||
:1008C00006D000201AF4709561957F4F0895F6F7D1
|
||||
:1008D000909581959F4F0895A1E21A2EAA1BBB1BEC
|
||||
:1008E000FD010DC0AA1FBB1FEE1FFF1FA217B307FC
|
||||
:1008F000E407F50720F0A21BB30BE40BF50B661F12
|
||||
:10090000771F881F991F1A9469F7609570958095D5
|
||||
:1009100090959B01AC01BD01CF01089597FB092E75
|
||||
:1009200005260ED057FD04D0D7DF0AD0001C38F4BE
|
||||
:1009300050954095309521953F4F4F4F5F4F08950B
|
||||
:10094000F6F790958095709561957F4F8F4F9F4FEB
|
||||
:100950000895AA1BBB1B51E107C0AA1FBB1FA61706
|
||||
:10096000B70710F0A61BB70B881F991F5A95A9F758
|
||||
:1009700080959095BC01CD010895EE0FFF1F059065
|
||||
:0A098000F491E02D0994F894FFCFE4
|
||||
:0C098A009001F40101000000009C01003D
|
||||
:00000001FF
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
Conditionals - while statement
|
||||
|
||||
This example demonstrates the use of while() statements.
|
||||
|
||||
It reads the state of a potentiometer (an analog input) and blinks an LED
|
||||
while the LED remains above a certain threshold level. It prints the analog value
|
||||
only if it's below the threshold.
|
||||
|
||||
This example uses principles explained in the BlinkWithoutDelay example as well.
|
||||
|
||||
The circuit:
|
||||
* potentiometer connected to analog pin 0.
|
||||
Center pin of the potentiometer goes to the analog pin.
|
||||
side pins of the potentiometer go to +5V and ground
|
||||
* LED connected from digital pin 13 to ground
|
||||
|
||||
* Note: On most Arduino boards, there is already an LED on the board
|
||||
connected to pin 13, so you don't need any extra components for this example.
|
||||
|
||||
created 17 Jan 2009
|
||||
by Tom Igoe
|
||||
|
||||
*/
|
||||
|
||||
#define ledPin 13 // the pin for the LED
|
||||
#define analogPin 0 // the analog pin that the potentiometer is attached to
|
||||
|
||||
int threshold = 400; // an arbitrary threshold level that's in the range of the analog input
|
||||
int ledState = LOW; // the state of the LED
|
||||
int lastBlinkTime = 0; // last time the LED changed
|
||||
int blinkDelay = 500; // how long to hold between changes of the LED
|
||||
int analogValue; // variable to hold the value of the analog input
|
||||
void setup() {
|
||||
// initialize the LED pin as an output:
|
||||
pinMode(ledPin, OUTPUT);
|
||||
// initialize serial communications:
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the value of the potentiometer:
|
||||
analogValue = analogRead(analogPin);
|
||||
|
||||
// if the analog value is high enough, turn on the LED:
|
||||
while (analogValue > threshold) {
|
||||
// if enough time has passed since the last change of the LED,
|
||||
// then change it. Note you're using the technique from BlinkWithoutDelay
|
||||
// here so that the while loop doesn't delay the rest of the program:
|
||||
|
||||
if (millis() - lastBlinkTime > blinkDelay) {
|
||||
// if the ledState is high, this makes it low, and vice versa:
|
||||
ledState = !ledState;
|
||||
digitalWrite(ledPin, ledState);
|
||||
|
||||
// save the last time the LED changed in a variable:
|
||||
lastBlinkTime = millis();
|
||||
}
|
||||
// while you're in the while loop, you have to read the
|
||||
// input again:
|
||||
analogValue = analogRead(analogPin);
|
||||
}
|
||||
|
||||
// if you're below the threshold, print the analog value:
|
||||
Serial.println(analogValue, DEC);
|
||||
// turn the LED off:
|
||||
digitalWrite(ledPin, LOW);
|
||||
|
||||
}
|
||||
|
Binary file not shown.
@ -1,45 +0,0 @@
|
||||
|
||||
#include "WProgram.h"
|
||||
void setup();
|
||||
void loop();
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
}
|
||||
void loop() {
|
||||
int distance = analogRead(0);
|
||||
|
||||
int range = map(distance, 0, 600, 0, 3);
|
||||
|
||||
switch (range) {
|
||||
case 0:
|
||||
Serial.println("dark");
|
||||
break;
|
||||
case 1:
|
||||
Serial.println("dim");
|
||||
break;
|
||||
case 2:
|
||||
Serial.println("medium");
|
||||
break;
|
||||
case 3:
|
||||
Serial.println("bright");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
:00000001FF
|
Binary file not shown.
@ -1,119 +0,0 @@
|
||||
:100000000C9435000C945D000C945D000C945D0024
|
||||
:100010000C945D000C945D000C945D000C945D00EC
|
||||
:100020000C945D000C945D000C945D000C945D00DC
|
||||
:100030000C945D000C945D000C945D000C945D00CC
|
||||
:100040000C94CD000C945D000C946D010C945D003B
|
||||
:100050000C945D000C945D000C945D000C945D00AC
|
||||
:100060000C945D000C945D00260211241FBECFEF9E
|
||||
:10007000D4E0DEBFCDBF11E0A0E0B1E0E4E2F7E004
|
||||
:1000800002C005900D92A232B107D9F711E0A2E2A9
|
||||
:10009000B1E001C01D92A13CB107E1F710E0CAE652
|
||||
:1000A000D0E004C02297FE010E948C03C836D1071D
|
||||
:1000B000C9F70E94C6000C9490030C940000AF9204
|
||||
:1000C000BF92CF92DF92EF92FF920F931F9380E047
|
||||
:1000D0000E944F0100D000D0AA2797FDA095BA2F0B
|
||||
:1000E00023E030E040E050E0EDB7FEB721833283FB
|
||||
:1000F00043835483BC01CD0120E030E040E050E078
|
||||
:10010000E8E5EE2EE2E0FE2E012D112DAA24BB24FF
|
||||
:1001100065010E94BE020F900F900F900F9061300A
|
||||
:10012000710591F0623071051CF4672B41F01CC021
|
||||
:100130006230710571F063307105B1F40FC08FEA60
|
||||
:1001400091E060E071E00EC08FEA91E065E071E05F
|
||||
:1001500009C08FEA91E069E071E004C08FEA91E0A4
|
||||
:1001600060E171E00E94B3021F910F91FF90EF9048
|
||||
:10017000DF90CF90BF90AF9008958FEA91E040E874
|
||||
:1001800055E260E070E00E94AA0108950E94150106
|
||||
:100190000E94BD000E945F00FDCF1F920F920FB61C
|
||||
:1001A0000F9211242F933F938F939F93AF93BF93FD
|
||||
:1001B0008091260190912701A0912801B0912901F9
|
||||
:1001C00030912A010196A11DB11D232F2D5F2D37DE
|
||||
:1001D00020F02D570196A11DB11D20932A01809377
|
||||
:1001E000260190932701A0932801B09329018091C3
|
||||
:1001F000220190912301A0912401B0912501019643
|
||||
:10020000A11DB11D8093220190932301A09324018D
|
||||
:10021000B0932501BF91AF919F918F913F912F9105
|
||||
:100220000F900FBE0F901F901895789484B5826040
|
||||
:1002300084BD84B5816084BD85B5826085BD85B58A
|
||||
:10024000816085BDEEE6F0E0808181608083E1E839
|
||||
:10025000F0E0808182608083808181608083E0E83B
|
||||
:10026000F0E0808181608083E1EBF0E08081846058
|
||||
:100270008083E0EBF0E0808181608083EAE7F0E05A
|
||||
:1002800080818460808380818260808380818160BE
|
||||
:1002900080838081806880831092C1000895877078
|
||||
:1002A000909117019295990F990F907C982B9093AC
|
||||
:1002B0007C0080917A00806480937A0080917A003B
|
||||
:1002C00086FDFCCF2091780040917900942F80E04A
|
||||
:1002D00030E0282B392BC90108951F920F920FB6D9
|
||||
:1002E0000F9211242F933F934F935F936F937F93BC
|
||||
:1002F0008F939F93AF93BF93EF93FF934091C6006B
|
||||
:10030000E091AB01F091AC01CF01019660E870E0A3
|
||||
:100310000E9426039C018091AD019091AE012817A7
|
||||
:10032000390739F0E55DFE4F40833093AC012093EF
|
||||
:10033000AB01FF91EF91BF91AF919F918F917F9111
|
||||
:100340006F915F914F913F912F910F900FBE0F9042
|
||||
:100350001F901895AF92BF92CF92DF92EF92FF92CB
|
||||
:100360000F931F93CF93DF936C017A018B01DC0114
|
||||
:100370001496AD90BC901597CB01BA0122E030E005
|
||||
:1003800040E050E00E945B03205C3D4B404F5F4FDC
|
||||
:10039000CA01B901A80197010E945B03C901DA01F2
|
||||
:1003A0000197A109B109292F3A2F4B2F552747FD56
|
||||
:1003B0005A950196A11DB11DE5012883E601EE8144
|
||||
:1003C000FF8181508083EA85FB85208141E050E0F8
|
||||
:1003D000CA010E8402C0880F991F0A94E2F7282BE5
|
||||
:1003E0002083EA85FB852081CA010F8402C0880F23
|
||||
:1003F000991F0A94E2F7282B2083EA85FB858081E8
|
||||
:10040000088802C0440F551F0A94E2F7842B8083AA
|
||||
:10041000DF91CF911F910F91FF90EF90DF90CF90E0
|
||||
:10042000BF90AF900895FC01A085B18521898C9182
|
||||
:1004300090E0022E02C0959587950A94E2F780FF1E
|
||||
:10044000F6CF0484F585E02D608308958CE191E07A
|
||||
:100450009093B0018093AF018BE291E09093B20151
|
||||
:100460008093B10185EC90E09093B4018093B30147
|
||||
:1004700084EC90E09093B6018093B50180EC90E01D
|
||||
:100480009093B8018093B70181EC90E09093BA010A
|
||||
:100490008093B90186EC90E09093BC018093BB01FE
|
||||
:1004A00084E08093BD0183E08093BE0187E0809368
|
||||
:1004B000BF0185E08093C00108950F931F93CF93F0
|
||||
:1004C000DF938C01EB0109C02196D801ED91FC91DD
|
||||
:1004D0000190F081E02DC801099568816623A1F79C
|
||||
:1004E000DF91CF911F910F910895EF92FF920F939B
|
||||
:1004F0001F93CF93DF938C017B01EA010CC0D701DE
|
||||
:100500006D917D01D801ED91FC910190F081E02D7C
|
||||
:10051000C80109952197209791F7DF91CF911F91FD
|
||||
:100520000F91FF90EF900895DC01ED91FC91028016
|
||||
:10053000F381E02D099508950F931F938C01DC0141
|
||||
:10054000ED91FC910190F081E02D6DE00995D801CD
|
||||
:10055000ED91FC910190F081E02DC8016AE00995D0
|
||||
:100560001F910F9108950F931F938C010E94940285
|
||||
:10057000C8010E949C021F910F9108952F923F92F3
|
||||
:100580004F925F926F927F928F929F92AF92BF92A3
|
||||
:10059000CF92DF92EF92FF920F931F93DF93CF934F
|
||||
:1005A000CDB7DEB73B014C0119012A016D897E8967
|
||||
:1005B0008F89988D6A197B098C099D09621A730AC3
|
||||
:1005C000840A950AA40193010E940703E218F30824
|
||||
:1005D00004091509A80197010E945B032A0D3B1D20
|
||||
:1005E0004C1D5D1DB901CA01CF91DF911F910F9183
|
||||
:1005F000FF90EF90DF90CF90BF90AF909F908F9043
|
||||
:100600007F906F905F904F903F902F900895629FE2
|
||||
:10061000D001739FF001829FE00DF11D649FE00DFA
|
||||
:10062000F11D929FF00D839FF00D749FF00D659F5B
|
||||
:10063000F00D9927729FB00DE11DF91F639FB00D5A
|
||||
:10064000E11DF91FBD01CF011124089597FB092E6B
|
||||
:1006500007260AD077FD04D049D006D000201AF42E
|
||||
:10066000709561957F4F0895F6F7909581959F4F0E
|
||||
:100670000895A1E21A2EAA1BBB1BFD010DC0AA1FE3
|
||||
:10068000BB1FEE1FFF1FA217B307E407F50720F0FB
|
||||
:10069000A21BB30BE40BF50B661F771F881F991F76
|
||||
:1006A0001A9469F760957095809590959B01AC01BF
|
||||
:1006B000BD01CF01089597FB092E05260ED057FDE9
|
||||
:1006C00004D0D7DF0AD0001C38F4509540953095FF
|
||||
:1006D00021953F4F4F4F5F4F0895F6F790958095C6
|
||||
:1006E000709561957F4F8F4F9F4F0895AA1BBB1B3D
|
||||
:1006F00051E107C0AA1FBB1FA617B70710F0A61B22
|
||||
:10070000B70B881F991F5A95A9F780959095BC0142
|
||||
:10071000CD010895EE0FFF1F0590F491E02D09948F
|
||||
:04072000F894FFCF7B
|
||||
:100724006461726B0064696D006D656469756D0068
|
||||
:1007340062726967687400010000000013025D02C0
|
||||
:0207440075023C
|
||||
:00000001FF
|
@ -1,56 +0,0 @@
|
||||
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
:00000001FF
|
Binary file not shown.
@ -1,87 +0,0 @@
|
||||
: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
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user