Acrob05: Rozdiel medzi revíziami
Zo stránky SensorWiki
Nová stránka: Predošlá úloha... | Späť do menu | Pokračovanie... |
Bez shrnutí editace |
||
Riadok 1: | Riadok 1: | ||
[[ | <source lang="c"> | ||
#define LED_Yellow 13 // select the pin for the green LED | |||
#define SENSOR_1 1 | |||
int pos = 0; // variable to store the servo position | |||
long val = 0; // variable to store the value coming from the sensor | |||
long Threshold = 0; // variable to store the value coming from the sensor | |||
byte SensorState = B0000; | |||
void setup() | |||
{ | |||
pinMode(LED_Yellow, OUTPUT); // declare this pin as an OUTPUT | |||
Serial.begin(9600); | |||
Serial.println("Test started \n"); | |||
delay(1000); | |||
} | |||
void loop() | |||
{ | |||
val = analogRead(SENSOR_1); // read the value from the sensor | |||
Serial.print("Sensor = "); | |||
Serial.println(val, DEC); | |||
delay(200); | |||
} /* End of Loop */ | |||
</source> | |||
[[Acrob04|Predošlá úloha...]] | [[Acrob|Späť do menu]] | [[Acrob06|Pokračovanie...]] |
Verzia z 21:25, 26. apríl 2010
#define LED_Yellow 13 // select the pin for the green LED
#define SENSOR_1 1
int pos = 0; // variable to store the servo position
long val = 0; // variable to store the value coming from the sensor
long Threshold = 0; // variable to store the value coming from the sensor
byte SensorState = B0000;
void setup()
{
pinMode(LED_Yellow, OUTPUT); // declare this pin as an OUTPUT
Serial.begin(9600);
Serial.println("Test started \n");
delay(1000);
}
void loop()
{
val = analogRead(SENSOR_1); // read the value from the sensor
Serial.print("Sensor = ");
Serial.println(val, DEC);
delay(200);
} /* End of Loop */