Problem using typedef enum


i've attached code i'm working on. of now, doesn't anything. i'm trying verify code, keep getting errors. believe has use of typedef enum.

when try build it, these errors:

arduino: 1.7.10 (windows 8.1), board: "arduino uno"

senior_design_v1.ino: in function 'void wireless_sig_1_rx()':

senior_design_v1.ino:83:21: error: expected primary-expression before '==' token

senior_design_v1.ino:85:19: error: expected unqualified-id before '=' token

senior_design_v1.ino:89:19: error: expected unqualified-id before '=' token

senior_design_v1.ino: in function 'void wireless_sig_2_rx()':

senior_design_v1.ino:97:17: error: expected unqualified-id before '=' token

senior_design_v1.ino: in function 'void wireless_sig_3_rx()':

senior_design_v1.ino:104:22: error: expected primary-expression before '==' token

senior_design_v1.ino:106:19: error: expected unqualified-id before '=' token

senior_design_v1.ino:110:19: error: expected unqualified-id before '=' token



i'm not sure "expected primary-expression before" means, , wasn't able find information.

here i'm trying accomplish:

a machine dispense 5 kinds of cards. yes, strong yes, neutral, no, strong no.

this accomplished 3 button wireless remote. yes or no button pressed twice in order select "strong" option.

any advice great.

leave "typedef" out of declaration. compiles fine:-
code: [select]
#include <servo.h>

/*******************************
       global variables
*******************************/

servo motor_1;
servo motor_2;
servo motor_3;
servo motor_4;
servo motor_5;
servo motor_6;


const byte limit_switch = 8;
const byte prox_switch = 4;
const byte wireless_sig_1 = 0; //positive response button
const byte wireless_sig_2 = 1; //neutral response button
const byte wireless_sig_3 = 2; //negative response button
const byte coin_detector = 7;
volatile boolean coin_accepted = false;
int something;
volatile enum
{
    none_selected = 0,
    no,
    strong_no,
    neutral,
    yes,
    strong_yes

} card_selected;


void setup()
{
    // put setup code here, run once:
    motor_1.attach(11);
    motor_2.attach(10);
    motor_3.attach(9);
    motor_4.attach(6);
    motor_5.attach(5);
    motor_6.attach(3);

    pinmode(coin_detector, input);  //input_pulldown?  (was in example)
    attachinterrupt(digitalpintointerrupt(coin_detector), coin_detect, rising);
    pinmode(wireless_sig_1, input);
    attachinterrupt(digitalpintointerrupt(wireless_sig_1), wireless_sig_1_rx, rising);
    pinmode(wireless_sig_2, input);
    attachinterrupt(digitalpintointerrupt(wireless_sig_2), wireless_sig_2_rx, rising);
    pinmode(wireless_sig_3, input);
    attachinterrupt(digitalpintointerrupt(wireless_sig_3), wireless_sig_3_rx, rising);
}


/*******************************
          main loop
*******************************/
void loop()
{
    // put main code here, run repeatedly:
}


/*******************************
    coin detector interrupt
*******************************/
void coin_detect()
{
    coin_accepted = true;
}

/*******************************
    wireless signal interrupts
*******************************/
//positive response button
void wireless_sig_1_rx()
{
    if (card_selected == yes)
    {
        card_selected = strong_yes;
    }
    else
    {
        card_selected = yes;
    }
}

//neutral response button
void wireless_sig_2_rx()
{
    card_selected = neutral;
}

//negative response button
void wireless_sig_3_rx()
{
    if (card_selected == no)
    {
        card_selected = strong_no;
    }
    else
    {
        card_selected = no;
    }
}


Arduino Forum > Using Arduino > Programming Questions > Problem using typedef enum


arduino

Comments

Popular posts from this blog

Valutazione Template - Joomla! Forum - community, help and support

SD Datastring Convention

First use of Arduino Uno : avrdude error on Blink uploading