Go Down

Topic: code of ESC (Read 2290 times) previous topic - next topic

Yahia_Elsaeed

the code :
#include <Servo.h>

Servo myservo;

void arm(){
 setSpeed(0);
 delay(1000); //delay 1 second,  some speed controllers may need longer
}

void setSpeed(int speed){

 int angle = map(speed, 0, 100, 0, 180);
 myservo.write(angle);   
}

void setup()
{
 myservo.attach(9);
 arm(); 
}

void loop()
{
 int speed;
 for(speed = 0; speed <= 100; speed += 5) {
   setSpeed(speed);
   delay(1000);
 }
 // sweep back down to 0 speed.
 for(speed = 95; speed > 0; speed -= 5) {
   setSpeed(speed);
   delay(1000);
 }
}


the contact way 

http://83.56.32.125/images/smesquema.jpg



all work ok with me .. but i want know what is must to edit from this code to can remove the pot ?

JimboZA

There's nothing in that code that has anything to do with the pot in the first place.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Yahia_Elsaeed

u mean if remove pot it will work without any edit in code ?

JimboZA

Well what line in that code do you think relate to a pot?
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Yahia_Elsaeed


Isaac96

There isn't even a line that relates to a input.
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

Yahia_Elsaeed

so can i use this connection now

http://api.ning.com/files/QYxylXSaas588I6jwxcoAJR8lBXneWApDBFHGCoOMg7Ge975QGTPeT0Qinw4ffnFDRoWYf7TcktkQRYX--0YwbQT05HgK*zp/arduino_esc_lucaszanela_com.png

without any modified in code ?

JimboZA

Well what line in that code do you think relate to a pot?
idk
You should work through the code line by line to answer my question. Answer is "none", as Isaac96 points out:

There isn't even a line that relates to a input.
So that code will not care if there's a pot attached or not.

Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

MarkT

so can i use this connection now

http://api.ning.com/files/QYxylXSaas588I6jwxcoAJR8lBXneWApDBFHGCoOMg7Ge975QGTPeT0Qinw4ffnFDRoWYf7TcktkQRYX--0YwbQT05HgK*zp/arduino_esc_lucaszanela_com.png

without any modified in code ?
Well you've removed the 5V supply to the Arduino from the ESC's BEC.

You'll have to have USB plugged in therefore.

Actually I'd never trust the BEC in a cheap ESC to power anything in the first place, I've seen ESC's
explode and die spectacularly...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Yahia_Elsaeed

i use EMAX esc  and it has high quality 

Isaac96

I use Turnigy Plush.  :) But I really killed one of my 3S LiPo batteries (it seems to have been crumpled) and the voltage dropped to 6V. I was wondering why the receiver wasn't turning on.  
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

Go Up