Pages: [1]   Go Down
Author Topic: error expected initializer at end of input  (Read 932 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there, I'm reasonably new to using Arduino and am trying to communicate using two Arduino's and an RF 433mhz Tx and Rx. I got this code off of http://forum.arduino.cc/index.php?topic=160262.0 just to do simple communication but am getting an error message on the receiver
Quote
expected initializer at end of input
I have been trying to get past this for a couple of days and have tried all the things suggested related to this error message like adding a semi-colon or using {} but no success.
I eventually want to move a servo with potentiometer like the knob example on the programmer but through wireless.
Any help with this code or the any code to achieve my goal would be greatly appreciated.
have been looking for code to do this for weeks but havent found anything simple enough to play around with, say add a few more pots and servos.
Anyway any help would be appreciated.

Code:
//Receiver Code
//Receiver Code
#include <Servo.h>

Servo myservo;            // Create servo object to control a servo

char readstr[4];          // Character Array to store the serial input
int cstrpos = 0;          // Variable to store current input array position
long val = 0;             // variable to store the value from the input

int maxValue = 175;

void setup()
{
  Serial.begin(9600);     // Startup the Serial Interface
  myservo.attach(9);      // Attaches the servo on pin 9 to the servo object
}

void loop()

Thanks
« Last Edit: June 09, 2013, 02:04:54 pm by meths87 » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26348
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your "loop" is missing a pair of braces.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Curly or normal?
Thanks for the help. I know a loop is probably quite basic and im being a noob but the programming is a small part of the project and didnt expect it to be quite this difficult to find a code from someone trying to do something dimilar.
Again thanks for your time.
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4264
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
void loop()
{
}
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Cincinnati, OH
Online Online
God Member
*****
Karma: 48
Posts: 816
I'm not bossy...I just know what you should be doing.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Usually, you'll hear programmers use the following:

{ -- Opening brace
} -- Closing brace
( -- Opening parenthesis
) -- Closing parenthesis
[ -- Opening bracket
] -- Closing bracket

In general,
   braces mark statement blocks (e.g., the start and end of a function block, start and end of an if statement block, loop structures)
   parentheses delineate parameter lists (e.g., arguments passed to functions) or are used to force the order in which an expression is evaluated (e.g., Y * (X + 2))
   brackets defines array size and rank


Logged

Pages: [1]   Go Up
Jump to: