My Arduino Electric Skateboard

Hello, my name is Jack and over the summer I have been working on an RF linked electric Skateboard using 433hz transmitters and receivers, however recently I have run into problems within my program and was hoping somebody could help me figure out the problem within the code since I am no expert. I am using an esc with a 4370 kv Brushless motor with 2 Arduino Nanos.

Hopefully somebody could find the problem i’ve been looking for, and thanks for your assistance.

Reciever.ino (430 Bytes)

Transmitter.ino (266 Bytes)

int val = (analogRead, potPin);

Problem there is your parentheses are in the wrong place.

int val = analogRead(potPin);
 vw_send((uint8_t *)val, 1);

Problem there is val is at least two bytes.

  if(vw_get_message(buf, &buflen))
  {
    for(int i = 0;i < buflen;i++);
  }

I don’t know what that’s supposed to do - the comment isn’t clear.

if(vw_get_message(buf, &buflen))
{
for(int i = 0;i < buflen;i++);
}

this part of my code is supposed to store the value coming in, which is the array buf and the buflen is the maximum length of one message received.

Jack_the_Hutt:
if(vw_get_message(buf, &buflen))
{
for(int i = 0;i < buflen;i++);
}

this part of my code is supposed to store the value coming in, which is the array buf and the buflen is the maximum length of one message received.

vw_get_message already stored the value coming in; your for loop does nothing at all - in fact, the compiler may even optimise it away.

Do you think my program would be better of without these commands?

Yes.

It is good programming practice to write code that not only does something useful, but also accomplishes your goals.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Did you write your code in stages and get each stage working, then combine them one at a time, or just write it all in one piece?

Thanks.. Tom... :)