Generation

generate functionThu, 01 Dec 2022

Bluetooth module using 4 motors robot in Arduino uno

#include <Servo.h> Servo servo_motors[4]; int motor_pins[4] = {9, 10, 11, 12}; int speed = 0; void setup() { Serial.begin(9600); for (int i=0; i<4; i++) { servo_motors[i].attach(motor_pins[i]); } } void loop() { if (Serial.available()) { switch (Serial.read()) { case 'a': servo_motors[0].write(180); servo_motors[1].write(0); servo_motors[2].write(180); servo_motors[3].write(0); break; case 'd': servo_motors[0].write(0); servo_motors[1].write(180); servo_motors[2].write(0); servo_motors[3

Questions about programming?Chat with your personal AI assistant