need help, pleeeesss :D

i try evry thing but i'm stuck,.
help pleeeesssss

/*

  • 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");
}

void set_kec_m2 (int kec) {
int kecepatan = map(kec, '0', '9', 0, 255);
analogWrite (enPin_m2, kecepatan);
Serial.print ("kecepatan m2:");
Serial.println (kecepatan);
}

void loop () {
if ( Serial.available() ) {
char ch = Serial.read ();
//--- command untuk motor M1 ---
if(ch >= '0' && ch <= '9') { //cek input angka int kecepaan = map(ch, '0', '9', 0, 255);
analogWrite (enPin_m1, kecepatan);
Serial.print ("kecepatan m1:");
Serial.println (kecepatan);
}
else if (ch == '+'){
Serial.println ("putaran M1 searah jarum jam");
digitalWrite (in1Pin_m1,LOW);
digitalWrite (in2Pin_m1,HIGH);
}
else if (ch == '-') {
Serial.println ("putaran M1 berlawanan arah jarum jam");
digitalWrite (in1Pin_m1, HIGH);
digitalWrite (in2Pin_m1, LOW);
}
// ---command untuk motor M2---
else if (ch == 'a') {
set_kec_m2(0);
}
else if (ch == 'b') {
set_kec_m2(1);
}
else if (ch == 'c') {
set_kec_m2(3);
}
else if (ch == 'd') {
set_kec_m2(4);
}
else if (ch == 'e') {
set_kec_m2(5);
}
else if (ch == 'f') {
set_kec_m2(6);
}
else if (ch == 'g') {
set_kec_m2(7);
}
else if (ch == 'h') {
set_kec_m2(8);
}
else if (ch == 'i') {
set_kec_m2(9);
}
else if (ch == '>'){
serial.printIn ("putaran M2 searah jarum jam");

digitalWrite (in1Pin_m2,LOW);
digitalWrite (in2Pin_m2,HIGH);
}
else if (ch == '<'){
serial.printIn ("putaran M2 berlawanan arah jarum jam");
digitalWrite (in1Pin_m2,HIGH);
digitalWrite (in2Pin_m2,LOW);
}

// --- akhir command untuk motor M2 ---

else {
Serial.print ("perintah");
Serial.print (ch);
Serial.print ("salah");
Serial.println ("");
}
}
}

Is there a question hidden somewhere?

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.

Please:D

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum.

COMMON ISSUES

  • Check you have a COMMON GROUND where required.
  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.
  • Try other computers where possible.
  • Try other USB leads where possible.
  • You may not have the correct driver installed. CH340/341 or CP2102
  • There may be a problem with the board check your wiring first.
  • Remove any items connected to pins 0 and 1.

COMPUTER RELATED

  • Close any other serial programs before opening the IDE.
  • Ensure you turn off any additional security / antivirus just to test.
  • There may be a problem with the PC try RESTARTING it.
  • You may be selecting the wrong COM port.
  • Avoid cloud/network based installations where possible OR ensure your Network/Cloud software is RUNNING.
  • Clear your browsers CACHE.
  • Close the IDE before using any other serial programs.
  • Preferably install IDE's as ADMINISTRATOR or your OS equivalent

Arduino specific boards

  • CH340/341 based clones do not report useful information to the "get board info" button.
  • NANO (Old Types) some require you to use the OLD BOOTLOADER option.
  • NANO (New Types) See the specific sections lower in the forum.
  • NANO (New Types) Install your board CORE's.
  • Unless using EXTERNAL PROGRAMMERS please leave the IDE selection at default "AVRISP mkII".

CREATE editor install locations.

  • On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
  • On Linux ~/ArduinoCreateAgent-1.1/config.ini
  • On Windows C:\Users[your user]\AppData\Roaming\ArduinoCreateAgent-1.1

Performing the above actions may help resolve your problem without further help.
Language problem ?
Try a language closer to your native language:

Thanks to all those who helped and added to this list.
Bob.

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");
}

void set_kec_m2 (int kec) {
int kecepatan = map(kec, '0', '9', 0, 255);
analogWrite (enPin_m2, kecepatan);
Serial.print ("kecepatan m2:");
Serial.println (kecepatan);
}

void loop () {
if ( Serial.available() ) {
char ch = Serial.read ();
//--- command untuk motor M1 ---
if(ch >= '0' && ch <= '9') { //cek input angka int kecepaan = map(ch, '0', '9', 0, 255);
analogWrite (enPin_m1, kecepatan);
Serial.print ("kecepatan m1:");
Serial.println (kecepatan);
}
else if (ch == '+'){
Serial.println ("putaran M1 searah jarum jam");
digitalWrite (in1Pin_m1,LOW);
digitalWrite (in2Pin_m1,HIGH);
}
else if (ch == '-') {
Serial.println ("putaran M1 berlawanan arah jarum jam");
digitalWrite (in1Pin_m1, HIGH);
digitalWrite (in2Pin_m1, LOW);
}
// ---command untuk motor M2---
else if (ch == 'a') {
set_kec_m2(0);
}
else if (ch == 'b') {
set_kec_m2(1);
}
else if (ch == 'c') {
set_kec_m2(3);
}
else if (ch == 'd') {
set_kec_m2(4);
}
else if (ch == 'e') {
set_kec_m2(5);
}
else if (ch == 'f') {
set_kec_m2(6);
}
else if (ch == 'g') {
set_kec_m2(7);
}
else if (ch == 'h') {
set_kec_m2(8);
}
else if (ch == 'i') {
set_kec_m2(9);
}
else if (ch == '>'){
serial.printIn ("putaran M2 searah jarum jam");

digitalWrite (in1Pin_m2,LOW);
digitalWrite (in2Pin_m2,HIGH);
}
else if (ch == '<'){
serial.printIn ("putaran M2 berlawanan arah jarum jam");
digitalWrite (in1Pin_m2,HIGH);
digitalWrite (in2Pin_m2,LOW);
}

// --- akhir command untuk motor M2 ---

else {
Serial.print ("perintah");
Serial.print (ch);
Serial.print ("salah");
Serial.println ("");
}
}
}

OP, you tried everything EXCEPT using code tags, and telling us what the problem is...both quite important as a new member of the forum.

switch() case - will make your character logic more readable.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum.

Bob.

void loop () {
if ( Serial.available() ) {
char ch = Serial.read ();
//--- command for motor M1 ---
if(ch >= '0' && ch <= '9' ) { //cek input number int kecepaan = map(ch, '0', '9', '0', 255);
analogWrite (enPin_m1, kecepatan);
Serial.print ("kecepatan m1:");
Serial.println (kecepatan);
}

Please post your complete code and error messages using code tags when you do

See Read this before posting a programming question

map(ch, '0', '9', '0', 255); Did you meanmap(ch, '0', '9', 0, 256);?

Duplicate topics merged

UKHeliBob:
Duplicate topics merged

I'm still seeing two posts.

Other post "need help, pleeeesss"

I've wasted my time on the other post!

@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’.