Go Down

Topic: Newbie needs assistance (Read 20088 times) previous topic - next topic

dhenry

I think those error messages are about deflectororange(): the macros didn't need a parameter in definition but were called with parameters.

I would use "()" in macros to signify that they are meant to provide some actions, not just parameters.

secretreeve


I think those error messages are about deflectororange(): the macros didn't need a parameter in definition but were called with parameters.

I would use "()" in macros to signify that they are meant to provide some actions, not just parameters.



Ah, i think that has something to do with it having to fade in/out of 2 different colors later on and fading on to the standby mode.

thanks for all the tips and help so far, now I had been given an idea where to start and nudged along the right path, this shouldnt be to difficult to get the larger amount of stages completed today/tomorow. Then its onto the fun part of loops, triggers and button reactions. ohh boy.

secretreeve

#32
Dec 21, 2012, 09:39 pm Last Edit: Dec 21, 2012, 10:09 pm by secretreeve Reason: 1
Okay, heres the definitions.

Code: [Select]
#define DIGITAL_ON(pin) digitalWrite(pin, LOW) //digital on, active low
#define DIGITAL_OFF(pin) digitalWrite(pin, HIGH) //digital off, active low

//define pins
#define PRIMARY 1 //primary on pin 1
#define SECONDARY 2 //secondary on pin2
#define DEFLECTORORANGE 3
#define DEFLECTORBLUE 4
#define NECELLS 5
#define IMPULSE 6
#define SHUTTLEBAY 7
#define SHUTTLEBAYDOORS 8
#define RCS 9
#define FLOODLIGHT 10
#define NAVIGATION 11
#define STROBES 12
#define TORPEDO 13
#define SHUTTLEBAYLANDING 14

//pin functions
#define PRIMARY_ON() DIGITAL_ON(PRIMARY)
#define SECONDARY_ON() DIGITAL_ON(SECONDARY)
#define DEFLECTORORANGE_ON() DIGITAL_ON(DEFLECTORORANGE)
#define DEFLECTORBLUE_ON() DIGITAL_ON(DEFLECTORBLUE)
#define NECELLS_ON() DIGITAL_ON(NECELLS)
#define IMPULSE_ON() DIGITAL_ON(IMPULSE)
#define SHUTTLEBAY_ON() DIGITAL_ON(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_ON() DIGITAL_ON(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_ON() DIGITAL_ON(SHUTTLEBAYLANDING)
#define RCS_ON() DIGITAL_ON(RCS)
#define FLOODLIGHT_ON() DIGITAL_ON(FLOODLIGHT)
#define NAVIGATION_ON() DIGITAL_ON(NAVIGATION)
#define STROBES_ON() DIGITAL_ON(STROBES)
#define TORPEDO_ON() DIGITAL_ON(TORPEDO)

#define PRIMARY_OFF() DIGITAL_OFF(PRIMARY)
#define SECONDARY_OFF() DIGITAL_OFF(SECONDARY)
#define DEFLECTOR_OFF() DIGITAL_OFF(DEFLECTOR)
#define NECELLS_OFF() DIGITAL_OFF(NECELLS)
#define IMPULSE_OFF() DIGITAL_OFF(IMPULSE)
#define SHUTTLEBAY_OFF() DIGITAL_OFF(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_OFF() DIGITAL_OFF(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_OFF() DIGITAL_OFF(SHUTTLEBAYLANDING)
#define RCS_OFF() DIGITAL_OFF(RCS)
#define FLOODLIGHT_OFF() DIGITAL_OFF(FLOODLIGHT)
#define NAVIGATION_OFF() DIGITAL_OFF(NAVIGATION)
#define STROBES_OFF() DIGITAL_OFF(STROBES)
#define TORPEDO_OFF() DIGITAL_OFF(TORPEDO)

#define LED_BLINK(pin, duration) do {LED_ON(pin); delay(duration); LED_OFF(pin);} while (0) //blink a pin for a given duration

int brightness = 5;
int fadeAmount = 5;
#define duration_1s 1000ul //define 1 second, in ms
#define duration_2s (duration_1s * 2) //2 second delay
#define duration_3s (duration_1s * 3) //3 second delay
#define duration_4s (duration_1s * 4) //4 second delay
#define duration_5s (duration_1s * 5) //5 second delay

//perform stage 1 activities
void stage1(void) {
 DIGITAL_ON(PRIMARY);
 delay (duration_1s);
 DIGITAL_ON(SECONDARY);
 delay (duration_1s);
 DIGITAL_ON(DEFLECTORORANGE) (brightness, 3);
 delay (duration_2s);
 DIGITAL_ON(NECELLS);
 DIGITAL_ON(IMPULSE)(brightness, 3);
 DIGITAL_ON(RCS)(brightness, 3);
 delay (duration_3s);
 DIGITAL_ON(SHUTTLEBAYDOORS);
 delay (duration_5s);
 DIGITAL_OFF(SHUTTLEBAYDOORS);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAY);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAYLANDING);
 delay (duration_1s);
 DIGITAL_ON(FLOODLIGHT);
 delay (duration_1s);
 DIGITAL_ON(NAVIGATION);
 DIGITAL_ON(STROBES);
 delay (duration_1s);
 DIGITAL_ON(TORPEDO) (brightness, 3);}


I'm being told this:

Code: [Select]
Enterprise_program_2.ino: In function 'void stage1()':
Enterprise_program_2:66: error: void value not ignored as it ought to be
Enterprise_program_2:69: error: void value not ignored as it ought to be
Enterprise_program_2:70: error: 'RCS' was not declared in this scope
Enterprise_program_2:85: error: void value not ignored as it ought to be


Is it possible to set a define for 50% brightness fade? or should I just keep that in the actual "command" of the program?

p.s I know pin allocation needs work, same with digital/analogue, as well as brightness control. I'll worry about that once I have the next sections of the program written out.

dhenry


secretreeve

#34
Dec 21, 2012, 11:34 pm Last Edit: Dec 21, 2012, 11:40 pm by secretreeve Reason: 1
thanks dhenry.

Can you give me a working example of fading one led off while another fades on?

i cant seem to find a decent example that makes sense.

I've got stages 1 2 and 3 written up and was going to start working on the fading effects of the LEDS that need it but struggling to put it together.

Like this for example

Code: [Select]
void stage3_warp_power(void) {
    DIGITAL_ON(SHUTTLEBAYDOORS)
    delay (duration_5s)
    DIGITAL_OFF(SHUTTLEBAYDOORS)
    delay (duration_2s)
    DIGITAL_ON(DEFLECTORBLUE);
    DIGITAL_ON(IMPULSEORANGE);
    DIGITAL_ON(NECELLS


the deflector needs to fade from

Code: [Select]
DIGITAL_ON(DEFLECTORORANGE)

TO

Code: [Select]
DIGITAL_ON(DEFLECTORBLUE)

Just not sure how to assemble that. the 2 colors are on different pins.

secretreeve

okay, found this.

Code: [Select]
for(brightness=0;brightness<=255;brightness+=5) {
    //Fade out red led value counts down from 255 to 0
    analogWrite(RedPin,255-brightness);
    //Fade in the green one value counts up
    analogWrite(OrangePin,brightness);
    delay(30);


but I have no idea how to integrate that into my code

secretreeve

#36
Dec 22, 2012, 07:19 pm Last Edit: Dec 22, 2012, 07:22 pm by secretreeve Reason: 1
NOW HAS ARDUINO BOARD!!!!!

went out and bought a board today. Still need to hook up the leds to actually test the program though.

heres the program with the pin definitions set correctly for PWM and the multicolor fade defines noted to be an RGB instead (RGB's on an arduino only use 1 pin right?)

Code: [Select]
#define DIGITAL_ON(pin) digitalWrite(pin, LOW) //digital on, active low
#define DIGITAL_OFF(pin) digitalWrite(pin, HIGH) //digital off, active low

//define pins
#define PRIMARY 1
#define SECONDARY 2
#define DEFLECTORRGB 3 //fade = ORANGE STANDBY BLUE WARP
#define SHUTTLEBAY 4
#define NECELLSRGB 5 //fade VIOLET STANDBY BLUE WARP
#define IMPULSEON 6 //fade
#define SHUTTLEBAYDOORS 7
#define FLOODLIGHT 8
#define IMPULSEORANGE 9 //fade
#define TORPEDO 10 //FADE
#define RCS 11 //FADE
#define NAVIGATION 12
#define STROBES 13
#define SHUTTLEBAYLANDING 0

//FADE PROGRAMMING - ASSIGN _FADE TO DEFINE

//pin functions
#define PRIMARY_ON() DIGITAL_ON(PRIMARY)
#define SECONDARY_ON() DIGITAL_ON(SECONDARY)
#define DEFLECTORORANGE_ON() DIGITAL_ON(DEFLECTORORANGE)
#define DEFLECTORBLUE_ON() DIGITAL_ON(DEFLECTORBLUE)
#define NECELLS_ON() DIGITAL_ON(NECELLS)
#define IMPULSE_ON() DIGITAL_ON(IMPULSE)
#define SHUTTLEBAY_ON() DIGITAL_ON(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_ON() DIGITAL_ON(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_ON() DIGITAL_ON(SHUTTLEBAYLANDING)
#define RCS_ON() DIGITAL_ON(RCS)
#define FLOODLIGHT_ON() DIGITAL_ON(FLOODLIGHT)
#define NAVIGATION_ON() DIGITAL_ON(NAVIGATION)
#define STROBES_ON() DIGITAL_ON(STROBES)
#define TORPEDO_ON() DIGITAL_ON(TORPEDO)

#define PRIMARY_OFF() DIGITAL_OFF(PRIMARY)
#define SECONDARY_OFF() DIGITAL_OFF(SECONDARY)
#define DEFLECTOR_OFF() DIGITAL_OFF(DEFLECTOR)
#define NECELLS_OFF() DIGITAL_OFF(NECELLS)
#define IMPULSE_OFF() DIGITAL_OFF(IMPULSE)
#define SHUTTLEBAY_OFF() DIGITAL_OFF(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_OFF() DIGITAL_OFF(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_OFF() DIGITAL_OFF(SHUTTLEBAYLANDING)
#define RCS_OFF() DIGITAL_OFF(RCS)
#define FLOODLIGHT_OFF() DIGITAL_OFF(FLOODLIGHT)
#define NAVIGATION_OFF() DIGITAL_OFF(NAVIGATION)
#define STROBES_OFF() DIGITAL_OFF(STROBES)
#define TORPEDO_OFF() DIGITAL_OFF(TORPEDO)

#define LED_BLINK(pin, duration) do {LED_ON(pin); delay(duration); LED_OFF(pin);} while (0) //blink a pin for a given duration

int brightness = 5;
int fadeAmount = 5;
#define duration_1s 1000ul //define 1 second, in ms
#define duration_2s (duration_1s * 2) //2 second delay
#define duration_3s (duration_1s * 3) //3 second delay
#define duration_4s (duration_1s * 4) //4 second delay
#define duration_5s (duration_1s * 5) //5 second delay

//perform stage 1 activities - startup
void stage1_startup(void) {
 DIGITAL_ON(PRIMARY);
 delay (duration_1s);
 DIGITAL_ON(SECONDARY);
 delay (duration_1s);
 DIGITAL_ON(DEFLECTORORANGE) (brightness, 3); //needs to fade to 50% on
 delay (duration_2s);
 DIGITAL_ON(NECELLSVIOLET); //fade on to 50%
 DIGITAL_ON(IMPULSEON)(brightness, 3); //fade on to 50%
 DIGITAL_ON(RCS)(brightness, 3); //fade on to 50%
 delay (duration_3s);
 DIGITAL_ON(SHUTTLEBAYDOORS);
 delay (duration_5s);
 DIGITAL_OFF(SHUTTLEBAYDOORS);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAY);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAYLANDING);
 delay (duration_1s);
 DIGITAL_ON(FLOODLIGHT);
 delay (duration_1s);
 DIGITAL_ON(NAVIGATION);
 DIGITAL_ON(STROBES);
 delay (duration_1s);
 DIGITAL_ON(TORPEDO) (brightness, 3); //fade on to 50%
 delay (duration_5s);}
 
 //perform stage 2 activities - Impulse power
 void stage2_impulse_power(void) {
 DIGITAL_ON(DEFLECTORORANGE); //fade on to 100%
 DIGITAL_ON(IMPULSEON) (brightness, 5); //fade on to 100%
 DIGITAL_ON (NECELLSVIOLET); //fade on to 100% violet
 DIGITAL_ON(RCS) (brightness, 5); //fade on to 100%
 DIGITAL_ON(TORPEDO) (brightness,5); //fade on to 100%
 DIGITAL_ON(SHUTTLEBAY);
 DIGITAL_ON(SHUTTLEBAYLANDING);}  
 
 //perform stage 3 activities - warp power
 void stage3_warp_power(void) {
   DIGITAL_ON(SHUTTLEBAYDOORS);
   delay (duration_5s);
   DIGITAL_OFF(SHUTTLEBAYDOORS);
   DIGITAL_OFF(SHUTTLEBAY);
   DIGITAL_OFF(SHUTTLEBAYLANDING);
   delay (duration_2s);
   DIGITAL_ON(DEFLECTORBLUE);; //fade off violet and on blue with transition
   DIGITAL_ON(IMPULSEORANGE);; //fade off red and on orange with transition
   DIGITAL_ON(NECELLSVIOLET); //fade off
   DIGITAL_ON(NECELLSBLUE); //fade on
   DIGITAL_ON(RCS) (brightness,3); //fade down to 50%
   DIGITAL_ON(TORPEDO) (brightness, 3);} //fade down to 50%
 
 
 //perform stage 4 activities
 void stage4(void) {
   DIGITAL_ON(SHUTTLEBAYDOORS);
   delay (duration_5s);
   DIGITAL_OFF(SHUTTLEBAYDOORS);}
   
     
 //perform stage 5 activities
 void stage5(void) {
   DIGITAL_OFF(SHUTTLEBAYLANDING);
   delay (duration_1s);
   DIGITAL_OFF(SHUTTLEBAY);
   DIGITAL_OFF(NECELLSVIOLET);
   delay (duration_1s);
   DIGITAL_OFF(NECELLSBLUE);
   delay (duration_1s);
   DIGITAL_OFF(TORPEDO);
   delay (duration_1s);
   DIGITAL_OFF(IMPULSEON);
   DIGITAL_OFF(IMPULSEORANGE);
   delay (duration_1s);
   DIGITAL_OFF(RCS);
   delay (duration_1s);
   DIGITAL_OFF(DEFLECTORBLUE);
   DIGITAL_OFF(DEFLECTORORANGE);
   delay (duration_1s);
   DIGITAL_OFF(SECONDARY);
   delay (duration_1s);
   DIGITAL_OFF(PRIMARY);
   delay (duration_1s);
   DIGITAL_OFF(FLOODLIGHT);}


Should I be concerned with this

Code: [Select]
Enterprise_program_2.ino: In function 'void stage1_startup()':
Enterprise_program_2:68: error: void value not ignored as it ought to be
Enterprise_program_2:71: error: void value not ignored as it ought to be
Enterprise_program_2:72: error: void value not ignored as it ought to be
Enterprise_program_2:87: error: void value not ignored as it ought to be
Enterprise_program_2.ino: In function 'void stage2_impulse_power()':
Enterprise_program_2:93: error: void value not ignored as it ought to be
Enterprise_program_2:95: error: void value not ignored as it ought to be
Enterprise_program_2:96: error: void value not ignored as it ought to be
Enterprise_program_2.ino: In function 'void stage3_warp_power()':
Enterprise_program_2:112: error: void value not ignored as it ought to be
Enterprise_program_2:113: error: void value not ignored as it ought to be


at the moment? These lines all match up to (brightness_X) commands and I dont have it programmed for the brightness and fade effects yet.

Will the program still run its course for testing it and do i need to get rid of the "VOID" tags?

secretreeve

#37
Dec 22, 2012, 07:49 pm Last Edit: Dec 22, 2012, 07:51 pm by secretreeve Reason: 1
Heres with the navigation and strobe code.

Can someone please help me incorporate the strobe and navigation into the main program?

It only needs to activated once and run for the entire program until manually powered off. They activate in stage 1 activities but I cant find anything on incorporating it with the main program.

Code: [Select]
#define DIGITAL_ON(pin) digitalWrite(pin, LOW) //digital on, active low
#define DIGITAL_OFF(pin) digitalWrite(pin, HIGH) //digital off, active low

//define pins
#define PRIMARY 1
#define SECONDARY 2
#define DEFLECTORRGB 3 //fade = ORANGE STANDBY BLUE WARP
#define SHUTTLEBAY 4
#define NECELLSRGB 5 //fade VIOLET STANDBY BLUE WARP
#define IMPULSEON 6 //fade
#define SHUTTLEBAYDOORS 7
#define FLOODLIGHT 8
#define IMPULSEORANGE 9 //fade
#define TORPEDO 10 //FADE
#define RCS 11 //FADE
#define NAVIGATION 12
#define STROBES 13
#define SHUTTLEBAYLANDING 0

//FADE PROGRAMMING - ASSIGN _FADE TO DEFINE

//NAVIGATION PROGRAMMING
int NAVIGATIONS = 12;
void setup() {               
  pinMode(NAVIGATION, OUTPUT);     
}
void loop() {
  digitalWrite(NAVIGATION, HIGH);
  delay(500);
  digitalWrite(NAVIGATION, LOW);
  delay(3000);}
 
//STROBE PROGRAMMING
int STROBE = 13;
void setup() {               
  pinMode(STROBES, OUTPUT);     
}
void loop() {
  digitalWrite(STROBES, HIGH);
  delay(100);
  digitalWrite(STROBES, LOW);
  delay(2000);}

//pin functions
#define PRIMARY_ON() DIGITAL_ON(PRIMARY)
#define SECONDARY_ON() DIGITAL_ON(SECONDARY)
#define DEFLECTORORANGE_ON() DIGITAL_ON(DEFLECTORORANGE)
#define DEFLECTORBLUE_ON() DIGITAL_ON(DEFLECTORBLUE)
#define NECELLS_ON() DIGITAL_ON(NECELLS)
#define IMPULSE_ON() DIGITAL_ON(IMPULSE)
#define SHUTTLEBAY_ON() DIGITAL_ON(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_ON() DIGITAL_ON(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_ON() DIGITAL_ON(SHUTTLEBAYLANDING)
#define RCS_ON() DIGITAL_ON(RCS)
#define FLOODLIGHT_ON() DIGITAL_ON(FLOODLIGHT)
#define NAVIGATION_ON() DIGITAL_ON(NAVIGATION)
#define STROBES_ON() DIGITAL_ON(STROBES)
#define TORPEDO_ON() DIGITAL_ON(TORPEDO)

#define PRIMARY_OFF() DIGITAL_OFF(PRIMARY)
#define SECONDARY_OFF() DIGITAL_OFF(SECONDARY)
#define DEFLECTOR_OFF() DIGITAL_OFF(DEFLECTOR)
#define NECELLS_OFF() DIGITAL_OFF(NECELLS)
#define IMPULSE_OFF() DIGITAL_OFF(IMPULSE)
#define SHUTTLEBAY_OFF() DIGITAL_OFF(SHUTTLEBAY)
#define SHUTTLEBAYDOORS_OFF() DIGITAL_OFF(SHUTTLEBAYDOORS)
#define SHUTTLEBAYLANDING_OFF() DIGITAL_OFF(SHUTTLEBAYLANDING)
#define RCS_OFF() DIGITAL_OFF(RCS)
#define FLOODLIGHT_OFF() DIGITAL_OFF(FLOODLIGHT)
#define NAVIGATION_OFF() DIGITAL_OFF(NAVIGATION)
#define STROBES_OFF() DIGITAL_OFF(STROBES)
#define TORPEDO_OFF() DIGITAL_OFF(TORPEDO)

#define LED_BLINK(pin, duration) do {LED_ON(pin); delay(duration); LED_OFF(pin);} while (0) //blink a pin for a given duration

int brightness = 5;
int fadeAmount = 5;
#define duration_1s 1000ul //define 1 second, in ms
#define duration_2s (duration_1s * 2) //2 second delay
#define duration_3s (duration_1s * 3) //3 second delay
#define duration_4s (duration_1s * 4) //4 second delay
#define duration_5s (duration_1s * 5) //5 second delay

//perform stage 1 activities - startup
void stage1_startup(void) {
  DIGITAL_ON(PRIMARY);
  delay (duration_1s);
  DIGITAL_ON(SECONDARY);
  delay (duration_1s);
  DIGITAL_ON(DEFLECTORRGB) (brightness, 3); //needs to fade to 50% on
  delay (duration_2s);
  DIGITAL_ON(NECELLSRGB); //fade on to 50%
  DIGITAL_ON(IMPULSEON)(brightness, 3); //fade on to 50%
  DIGITAL_ON(RCS)(brightness, 3); //fade on to 50%
  delay (duration_3s);
  DIGITAL_ON(SHUTTLEBAYDOORS);
  delay (duration_5s);
  DIGITAL_OFF(SHUTTLEBAYDOORS);
  delay (duration_1s);
  DIGITAL_ON(SHUTTLEBAY);
  delay (duration_1s);
  DIGITAL_ON(SHUTTLEBAYLANDING);
  delay (duration_1s);
  DIGITAL_ON(FLOODLIGHT);
  delay (duration_1s);
  DIGITAL_ON(NAVIGATION);
  DIGITAL_ON(STROBES);
  delay (duration_1s);
  DIGITAL_ON(TORPEDO) (brightness, 3); //fade on to 50%
  delay (duration_5s);}
 
  //perform stage 2 activities - Impulse power
  void stage2_impulse_power(void) {
  DIGITAL_ON(DEFLECTORRGB); //fade on to 100%
  DIGITAL_ON(IMPULSEON) (brightness, 5); //fade on to 100%
  DIGITAL_ON (NECELLSRGB); //fade on to 100% violet
  DIGITAL_ON(RCS) (brightness, 5); //fade on to 100%
  DIGITAL_ON(TORPEDO) (brightness,5); //fade on to 100%
  DIGITAL_ON(SHUTTLEBAY);
  DIGITAL_ON(SHUTTLEBAYLANDING);} 
 
  //perform stage 3 activities - warp power
  void stage3_warp_power(void) {
    DIGITAL_ON(SHUTTLEBAYDOORS);
    delay (duration_5s);
    DIGITAL_OFF(SHUTTLEBAYDOORS);
    DIGITAL_OFF(SHUTTLEBAY);
    DIGITAL_OFF(SHUTTLEBAYLANDING);
    delay (duration_2s);
    DIGITAL_ON(DEFLECTORRGB);; //fade off violet and on blue with transition
    DIGITAL_ON(IMPULSEORANGE);; //fade off red and on orange with transition
    DIGITAL_ON(NECELLSRGB); //fade off
    DIGITAL_ON(NECELLSRGB); //fade on
    DIGITAL_ON(RCS) (brightness,3); //fade down to 50%
    DIGITAL_ON(TORPEDO) (brightness, 3);} //fade down to 50%
 
 
  //perform stage 4 activities
  void stage4(void) {
    DIGITAL_ON(SHUTTLEBAYDOORS);
    delay (duration_5s);
    DIGITAL_OFF(SHUTTLEBAYDOORS);}
   
     
  //perform stage 5 activities
  void stage5(void) {
    DIGITAL_OFF(SHUTTLEBAYLANDING);
    delay (duration_1s);
    DIGITAL_OFF(SHUTTLEBAY);
    DIGITAL_OFF(NECELLSRGB);
    delay (duration_1s);
    DIGITAL_OFF(NECELLSRGB);
    delay (duration_1s);
    DIGITAL_OFF(TORPEDO);
    delay (duration_1s);
    DIGITAL_OFF(IMPULSEON);
    DIGITAL_OFF(IMPULSEORANGE);
    delay (duration_1s);
    DIGITAL_OFF(RCS);
    delay (duration_1s);
    DIGITAL_OFF(DEFLECTORRGB);
    DIGITAL_OFF(DEFLECTORRGB);
    delay (duration_1s);
    DIGITAL_OFF(SECONDARY);
    delay (duration_1s);
    DIGITAL_OFF(PRIMARY);
    delay (duration_1s);
    DIGITAL_OFF(FLOODLIGHT);}

dxw00d

Have you tried compiling that? Is there some reason you have two sets of setup() and loop() functions?

secretreeve


Have you tried compiling that? Is there some reason you have two sets of setup() and loop() functions?


Theres 2 sets of loop and setups because its stock code from the examples with the timings adjusted to meet my needs but I dont know how to add it into my program so it works, so I have left it as standard for now until someone can help me work it into the program.

dhenry

Quote
Should I be concerned with this


You should be concerned with all error / warning messages: the compiler is trying to tell you something about your code.

Code: [Select]

Enterprise_program_2.ino: In function 'void stage1_startup()':
Enterprise_program_2:68: error: void value not ignored as it ought to be
Enterprise_program_2:71: error: void value not ignored as it ought to be


No one is going to go through your code and count which lines these messages are about. You have to help us help you.

Quote
It only needs to activated once and run for the entire program until manually powered off.


That sounds like part of your setup.

Quote
I dont know how to add it into my program so it works,


Rather than diving into a project right away, I think you can go a lot faster if you slow down and read a few books /  manuals about programming and the environment / ide.


secretreeve

#41
Dec 22, 2012, 09:28 pm Last Edit: Dec 22, 2012, 09:29 pm by secretreeve Reason: 1
I dont learn by reading. I learn by doing things and when I come against a wall, asking for help. Books cannot hold me and get bored far to quickly. I also struggle absorbing information from them.

I need the strobes and navigation lights to come on at a certain point within the startup sequence, so i guess i need to program in the strobe and blink rates and then link a trigger of some sort to it?

But thats beyond me at the moment so will need help there.

the error messages are here. sorry for not being in code tags, bold wont work with them in place.

#define NAVIGATION_OFF() DIGITAL_OFF(NAVIGATION)
#define STROBES_OFF() DIGITAL_OFF(STROBES)
#define TORPEDO_OFF() DIGITAL_OFF(TORPEDO)
//this blank line is regiserting as an error
#define LED_BLINK(pin, duration) do {LED_ON(pin); delay(duration); LED_OFF(pin);} while (0) //blink a pin for a given duration

int brightness = 5;
int fadeAmount = 5;
#define duration_1s 1000ul //define 1 second, in ms
#define duration_2s (duration_1s * 2) //2 second delay
#define duration_3s (duration_1s * 3) //3 second delay
#define duration_4s (duration_1s * 4) //4 second delay
#define duration_5s (duration_1s * 5) //5 second delay

//perform stage 1 activities - startup
void stage1_startup(void) {
 DIGITAL_ON(PRIMARY);
 delay (duration_1s);
 DIGITAL_ON(SECONDARY);
 delay (duration_1s);
 DIGITAL_ON(DEFLECTORRGB) (brightness, 3); //needs to fade to 50% on
 delay (duration_2s);
 DIGITAL_ON(NECELLSRGB); //fade on to 50%
 DIGITAL_ON(IMPULSEON)(brightness, 3); //fade on to 50%
 DIGITAL_ON(RCS)(brightness, 3); //fade on to 50%
 delay (duration_3s);
 DIGITAL_ON(SHUTTLEBAYDOORS);
 delay (duration_5s);
 DIGITAL_OFF(SHUTTLEBAYDOORS);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAY);
 delay (duration_1s);
 DIGITAL_ON(SHUTTLEBAYLANDING);
 delay (duration_1s);
 DIGITAL_ON(FLOODLIGHT);
 delay (duration_1s);
 DIGITAL_ON(NAVIGATION);
 DIGITAL_ON(STROBES);
 delay (duration_1s);
 DIGITAL_ON(TORPEDO) (brightness, 3); //fade on to 50%
 delay (duration_5s);}
 
 //perform stage 2 activities - Impulse power
 void stage2_impulse_power(void) {
DIGITAL_ON(DEFLECTORRGB); //fade on to 100%
 DIGITAL_ON(IMPULSEON) (brightness, 5); //fade on to 100%
 DIGITAL_ON (NECELLSRGB); //fade on to 100% violet

dhenry

Quote
I learn by doing things


That approach works for exceptionally gifted people.

That's why they have books for the rest of us mortals.

Quote
//this blank line is regiserting as an error


What is the error message? How was the macro invoked? ...

secretreeve

Enterprise_program_2.ino: In function 'void stage1_startup()':
Enterprise_program_2:72: error: void value not ignored as it ought to be
Enterprise_program_2:75: error: void value not ignored as it ought to be
Enterprise_program_2:76: error: void value not ignored as it ought to be
Enterprise_program_2:91: error: void value not ignored as it ought to be
Enterprise_program_2.ino: In function 'void stage2_impulse_power()':
Enterprise_program_2:97: error: void value not ignored as it ought to be
Enterprise_program_2:99: error: void value not ignored as it ought to be
Enterprise_program_2:100: error: void value not ignored as it ought to be
Enterprise_program_2.ino: In function 'void stage3_warp_power()':
Enterprise_program_2:116: error: void value not ignored as it ought to be
Enterprise_program_2:117: error: void value not ignored as it ought to be


those are only error messages, including for the blank line.

dhenry

You probably want to learn about debugging yourself, reading a book or not.

But it looks like the compiler is complaining about DIGITAL_ON() and DIGITAL_OFF(): the 2nd the last invokation of DIGITAL_ON() takes three parameters and is clearly in contradiction with others invocations of DIGITAL_ON/OFF.


Go Up