Translate

marți, 31 octombrie 2023

RC car toy TX2/RX2 with arduino | costycnc rc car tx rx




https://forum.arduino.cc/index.php?topic=171238.0

rc_car1 I put D2 signal to ground and working good

               upload to arduino rc_car1.ino
               welding wire from arduino to rc car (ground,power and D2) same as rc_car1.jpg photo
               send command letter under serial ... the car need to rispond with moving
               
               a Forward 
               b Forward Turbo 
               c Forward & Left 
               d Forward & Right
               e Backward
               f Backward & Right
               g Backward & Left
               h Left
               i Right

 


Source https://github.com/costycnc/costycnc-toy-rc-car-arduino-ide/

 /*Data Format

W2 W2 W2 W2 (n) x W1 W2 W2 W2 W2 (n) x W1 W2 W2 W2 W2

Number of Function Codes (n) W1 Function Key Decode Result

4 End Code

10 Forward Forward

16 Forward & Turbo Forward

22 Turbo Turbo

28 Turbo & Forward & Left Forward & Left

34 Turbo & Forward & Right Forward & Right

40 Backward Backward

46 Backward & Right Backward & Right

52 Backward & Left Backward & Left

58 Left Left

64 Right Right

*/


void setup()

{

 pinMode(2, OUTPUT);

}


void loop()

{

   delay(1000); 

    for(int i=0; i<=30; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

 for(int i=0; i<=3; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(1500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

 for(int i=0; i<=9; i++) // This makes the car go "forward" 10 W1 pulses 500Mhz 50% duty cycle

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

}


 delay(1000); 

    for(int i=0; i<=30; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

 for(int i=0; i<=3; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(1500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

 for(int i=0; i<=39; i++) // This makes the car go "forward" 10 W1 pulses 500Mhz 50% duty cycle

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

}

 delay(1000); 

    for(int i=0; i<=30; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

 for(int i=0; i<=3; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(1500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

 for(int i=0; i<=45; i++) // This makes the car go "forward" 10 W1 pulses 500Mhz 50% duty cycle

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

}

 delay(1000); 

    for(int i=0; i<=30; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

 for(int i=0; i<=3; i++) // This starts the communication 4 W2 pulses 1KHz 75% duty cycle 

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(1500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

 for(int i=0; i<=63; i++) // This makes the car go "forward" 10 W1 pulses 500Mhz 50% duty cycle

 {

   digitalWrite(2, HIGH);

   delayMicroseconds(500);


   digitalWrite(2, LOW);

   delayMicroseconds(500);

 }

}

}

duminică, 29 octombrie 2023

PROGRAMMING AN ATMEGA328P WITHOUT THE ARDUINO IDE

This site https://www.costycnc.it/avr-hex-uploader is make manually by me and not have yet implemented all asm code ... so if want to help me are welcome!

This page was created for upload hex code to arduino nano ( for upload grbl firmware to arduino nano used in my costycnc foam cutter costycnc https://www.costycnc.it) ... but i added some functions (after tons of hours and google search and tests) that permit you not only upload your firmware to arduino but also create your small code in asm , compile it and upload to arduino!

So you can watch this first video tutorial https://youtu.be/0i8CgucF1Bg?si=npn7C0CtkzRj3GIi (is in italian but translated in english too) you will understand purpose of this site. 

In few words ... you can compile asm code and upload to arduino nano only with this page. 

In this mode you have many advantages :

-You can learn the base of microcontroller in generally and specially atmega328 architecture.

-You can learn the base of asm language (many are unknown now even to me!!!)

-You can create in this mode very small code.

-You can see in my tutorials practice example without download hudge programs.

And many other advantages  which do not come to my mind now!







See my channels for anothers videos!

https://www.youtube.com/@bobyca2003