555 Timer Circuit Design
0:42
'0' and '9'), it converts the digit to a number and (as an example) scales it to a servo angle (by multiplying by 20, which roughly maps 0–9 to 0–180).'A', 'B', 'E', or 'F', it performs the corresponding motor actions using analogWrite on izqA and izqB.Cpp
#include #include Servo miservo; char valor; // Variable to store the received character int bluetoothTx = 10; int bluetoothRx = 11; int izqA = 7; int izqB = 8; SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); void setup() { Serial.begin(9600); pinMode(izqA, OUTPUT); pinMode(izqB, OUTPUT); miservo.attach(9); bluetooth.begin(9600); } void loop() { if (bluetooth.available() > 0) { // Read one character from Bluetooth valor = bluetooth.read(); Serial.print("Received: "); Serial.println(valor); // Example handling for a numeric command (for servo control) if (valor >= '0' && valor <= '9') { // Convert the digit character (0-9) to an int and scale it to 0-180 servo range. int servopos = (valor - '0') * 20; Serial.print("Servo Pos: "); Serial.println(servopos); miservo.write(servopos); } // Control motor based on letter commands if (valor == 'A') { analogWrite(izqA, 0); analogWrite(izqB, 100); } else if (valor == 'B') { analogWrite(izqA, 100); analogWrite(izqB, 0); } else if (valor == 'E' || valor == 'F') { analogWrite(izqA, 0); analogWrite(izqB, 0); } } }
0:13
0:11
Ready.
Reviews
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|
Assets
No assets added.
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.