code stuff Get link Facebook X Pinterest Email Other Apps January 13, 2023 This is my post[video] void setup() { // put your setup code here, to run once: //add serial communication Serial.begin(9600); //declaring digtal outputs for leds pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); //setting up a digital input (pushbutton) pinMode(12, INPUT); digitalWrite(12, HIGH); } void loop() { // put your main code here, to run repeatedly: //is button being pressed? if (digitalRead(12) == 0) { //if so, is potentiometer in first third? if (analogRead(A0) < 350) { //if so, write high on 11, low on 9 and 10 digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, HIGH); } //in 2nd 3rd? if (analogRead(A0) > 350 && analogRead(A0) < 700) { digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(11, LOW); } //in 3rd 3rd? if (analogRead(A0) > 700) { digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(11, LOW); } } else { //if button isnt pressed, set everything to LOW instead digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); } } Get link Facebook X Pinterest Email Other Apps Comments
My First Tinkercad Model: A Castle! January 11, 2023 I created my very first (not actually but this is a demo) model in Tinkercad: A stylized castle / fortress! Read more
Comments
Post a Comment