sketchbook dinamo_dc2.ino berbasis penguat H-Bridge L293
kecepatan dinamo ditentukan dari masukan serial:
masukan 0 untuk stop dan 9 kecepatan tertinggi motor M1
masukan "+" dan "-" untuk mengubah arah putaran motor M1
masukan 1 untuk stop dan i kecepatan tertinggi motor M2
masukan "<" dan ">" untuk mengubah arah putaran motor M2
*/
//--Pin motor M1--
const int enPin_m1 = 5; // Pin enable H-Bridge motor M1
const int in1Pin_m1 = 7; // Pin input H-Bridge
const int in2Pin_m1 = 4;
//--Pin motor M2--
const int enPin_m2 = 6; // Pin enable H-Bridge motor M2
const int in1Pin_m2 = 3; // Pin input H-Bridge
const int in2Pin_m2 = 2;
void setup ()
{
Serial.begin (9600);
pinMode (in1Pin_m1, OUTPUT);
pinMode (in2Pin_m1, OUTPUT);
pinMode (in1Pin_m2, OUTPUT);
pinMode (in2Pin_m2, OUTPUT);
Serial.println ("Kecepatan 0-9 dan + - arah putaran motor M1");
Serial.println ("Kecepatan a-i dan >< arah putaran motor M2");
}
int kecepatan = map(kec, '0', '9', 0, 255);
You are declaring kecepatan in one function, and then trying to access in another function.
Declare kecepatan at the top of the sketch, before SetUp, so both functions can see it and use it.
Use Serial instead of serial ( S instead of s )
Use Serial.println instead of Serial.printIn ( little L instead of a big I )
In File\Preferences\Settings : tick the boxes next to 'Show verbose output during:'. You will see the errors.
need help for my project it's beginer so.. it must be easy for you gusy,.
/*
sketchbook dinamo_dc2.ino berbasis penguat H-Bridge L293
kecepatan dinamo ditentukan dari masukan serial:
masukan 0 untuk stop dan 9 kecepatan tertinggi motor M1
masukan "+" dan "-" untuk mengubah arah putaran motor M1
masukan 1 untuk stop dan i kecepatan tertinggi motor M2
masukan "<" dan ">" untuk mengubah arah putaran motor M2
*/
//--Pin motor M1--
const int enPin_m1 = 5; // Pin enable H-Bridge motor M1
const int in1Pin_m1 = 7; // Pin input H-Bridge
const int in2Pin_m1 = 4;
//--Pin motor M2--
const int enPin_m2 = 6; // Pin enable H-Bridge motor M2
const int in1Pin_m2 = 3; // Pin input H-Bridge
const int in2Pin_m2 = 2;
void setup ()
{
Serial.begin (9600);
pinMode (in1Pin_m1, OUTPUT);
pinMode (in2Pin_m1, OUTPUT);
pinMode (in1Pin_m2, OUTPUT);
pinMode (in2Pin_m2, OUTPUT);
Serial.println ("Kecepatan 0-9 dan + - arah putaran motor M1");
Serial.println ("Kecepatan a-i dan >< arah putaran motor M2");
}
@fawaid...
Read and respond to the help that’s offered, otherwise people will lose interest in making further suggestions.
So far you’ve shown zero interest in participating, just ‘wanting’.