Arduino sketch [two buttons control one LED (on and off)]
const int buttonPin1 = 2; // the number of the pushbutton pin
const int buttonPin2 = -3;
const int ledPin1 = 13; // the number of the LED pin
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2,INPUT);
pinMode(ledPin1, OUTPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
if ((digitalRead(buttonPin1) == HIGH) && (digitalRead(buttonPin2) == LOW)) {
digitalWrite(ledPin1,HIGH);
}
if ((digitalRead(buttonPin1) == LOW) && (digitalRead(buttonPin2)) == HIGH) {
digitalWrite(ledPin1,LOW);
}
}
After opening the top shell, a circuit board which connected to different wires appeared. The wires were connecting to another place which was interesting and was very excited to explore.
Hello, I am Xiaohan. I am from China. I had my bachelor degree in Metals and Jewelry. I did a lot of hand-crafted projects in the past. Nowadays, digital is becoming more and more popular and important in peoples’ life. I am really interested combining my work with electronics and coding. I like to go to karaoke and play board games in my spare time. Looking forward to work with you all in the future. I bleached my hair recently so now my hair looks slightly grey-ish and yellow-ish.