Duration 2:22

Use AI CHAT GPT to build Arduino Automatic Clothesline Retrieval System-1 /使用 CHAT GPT 有效地編程製作自動涼衫衣架

51 watched
0
0
Published 2023/03/28

An AI way for beginners to learn Arduino programming with ChatGPT-Arduino NANO w/ extension board. For easy assembling with the sockets, pin # have been reassign,use rain/humidity senser and or light sensor as input,and L293 to drive the gear motor...... full program: // Define motor pins const int motorPin1 = 3; const int motorPin2 = 4; // Define limit switch pins const int limitSwitch1 = 7; const int limitSwitch2 = 8; // Define joystick pins const int joystick1Pin = A0; const int joystick2Pin = A3; void setup() { // Set motor pins as output pinMode(motorPin1, OUTPUT); pinMode(motorPin2, OUTPUT); // Set limit switch pins as input pinMode(limitSwitch1, INPUT_PULLUP); pinMode(limitSwitch2, INPUT_PULLUP); // Set joystick pins as input pinMode(joystick1Pin, INPUT_PULLUP); pinMode(joystick2Pin, INPUT_PULLUP); } void loop() { // Read joystick states bool joystick1State = digitalRead(joystick1Pin); bool joystick2State = digitalRead(joystick2Pin); // Move motor right if joystick 1 is pressed if (joystick1State == LOW) { while (digitalRead(limitSwitch1) == HIGH) { digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); } digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); } // Move motor left if joystick 2 is pressed if (joystick2State == LOW) { while (digitalRead(limitSwitch2) == HIGH) { digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); } digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); } }

Category

Show more

Comments - 0