1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-12 20:49:16 +03:00

Adding Tom's new examples.

This commit is contained in:
David A. Mellis
2009-07-11 00:34:59 +00:00
parent 8d73929f5d
commit 29c339013a
55 changed files with 7166 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#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;
}