703
edits
m (Created page with "=== resistive Sensor === File:Resistive_Sensor_Steckplatine.png <source lang="c"> int mySensorValue; void setup () { Serial.begin(); } void loop () { mySensorValue = ...") |
mNo edit summary |
||
Line 8: | Line 8: | ||
void setup () { | void setup () { | ||
Serial.begin(); | Serial.begin(9600); | ||
} | } | ||
Line 15: | Line 15: | ||
Serial.print("The Sensor Value is: "); | Serial.print("The Sensor Value is: "); | ||
Serial.println(mySensorValue); | Serial.println(mySensorValue); | ||
} | |||
</source> | |||
=== switch or Button === | |||
[[File:Button_1k_Pullup_Steckplatine.png]] | |||
<source lang="c"> | |||
int mySensorValue; | |||
void setup () { | |||
Serial.begin(9600); | |||
pinMode(13,OUTPUT); | |||
pinMode(4,INPUT); | |||
} | |||
void loop () { | |||
mySensorValue = digitalRead(4); | |||
if (mySensorValue == LOW) { | |||
Serial.println("The Button is pressed. "); | |||
digitalWrite(13,HIGH); | |||
} | |||
else { | |||
Serial.println("The Button is not pressed"); | |||
digitalWrite(13,LOW); | |||
} | |||
} | } | ||
</source> | </source> |
edits