SlotForum banner
1 - 20 of 24 Posts

·
Registered
Joined
·
14 Posts
Discussion Starter · #1 ·
is there a way to identify the type of competition with arduino? for example to know if the competition is "practice" or "round robin"? i would like to managment a green led when only "practice" is in progress.
 

·
Living the Life!
Joined
·
11,082 Posts
Hi macvolo,

How are you setting up your races and how are they controlled while they are running?
 

·
Banned
Joined
·
8,038 Posts
is there a way to identify the type of competition with arduino? for example to know if the competition is "practice" or "round robin"? I would like to managment a green led when only "practice" is in progress.
The competition type is a function of the race software not the arduino.
Assuming your software has a practice mode, practice is then shown on screen.
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #4 ·
thanks for the replay,

i use a practice mode and a race mode similar to round robin but with some graphics customizations.

I have a diorama and i 'd like to managment the green traffic light correctly: off during the race and on during practice and i thought it was possible to interceptthis information in arduino sw.

maybe i have to concentrate on the differences between the two modes, like the presence of start traffic light only in the race.
 

·
Premium Member
Joined
·
1,640 Posts
Yeah, the arduino can't tell what race configuration you're running, but it understands things like race state. I'm not sure you can really use that either though as both practice and real races have a concept of yellow flags, green flags, etc.

You might be able to do something a bit hackish, like some difference between your two race conditions. I'm thinking about the time of each "heat" or some such... once you can accurately identify which configuration you are running it would be pretty easy to turn an LED on/off by modifying the sketch and likely using the extended protocol to do so.
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #6 ·
in fact i am thinking of identify the types of races but not with the time because i use the laps. i'll try as i can to identify some messages (empty, low fuel, best lap, ecc)
 

·
Rich Dumas
Joined
·
3,568 Posts
Are you using a separate track power relay? If so you can connect a double throw relay to that so you will have a green light when the track power is on and a red light when the track power is off. The lights on my track have their own power supply and the red and green LEDs need different dropping resistors.
 

·
Rich Dumas
Joined
·
3,568 Posts
I guess that went over my head because I do not consider practice to be a race mode. So the OP wants lights to distinguish between practice and racing. Someone mentioned that the computer screen would tell you what mode you were using, but not every track has a screen located where the drivers can see it. I can't think of any way to switch the lights using the software and an Arduino board. That feature would have to be written into the software for a start.
 

·
Premium Member
Joined
·
1,640 Posts
Yeah, like I said, if there's some obvious difference between race and practice AND that difference is somehow passed into the arduino sketch through the extended protocol you can then do it.

One way you could do it is to create two tracks within RC. The first track would be your race setup and be configured as normal. The second track would be exactly the same except you configure some unused pin on the arduino for one of the LEDs. You could then put code into the sketch to set a flag if/when that particular pin is configured thus telling you the difference between the two races. It's a total hack, but the pin configured to an LED that doesn't exist would be harmless as long as you don't have anything wired to it...
 

·
Rich Dumas
Joined
·
3,568 Posts
I think that would work. I use Trackmate and my HO track can be configured as an oval or a road course. I have several versions of the Trackmate software loaded and one is set up for the oval while another is set up for the road course.
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #12 ·
i'm sorry but there isn't difference between normal race and a practice race with normal setting of arduino (like power rele, calbutton lap sensor, etc.).
 

·
Premium Member
Joined
·
1,640 Posts
That's correct. But as I said in post #10 you could configure a some pin you don't actually use to trigger an LED that you don't actually have wired up to anything. You could put code into the sketch to notice when that pin is enabled, and by doing so know which race you're running. It's a horrible way to go about it but it would work.
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #14 ·
ok guys
I managed to change the sketch and now I have a led lit in practice and in the race until the traffic light turns off, and it's perfect. like follow:

case 3:
// Heat starting (2)
//***************************************************
// Start Sequence
if (inBuffer[3] == 2 && inBuffer[2] == 4) // Start Of Sequnce - Lights off, and first light on.
{
digitalWrite(13, 0); //resta acceso in practice e anche in gara e si spegne non appena compare il semaforo spento
}
else
{
digitalWrite(13, 1); // resta spento in gara
}
break;
//**************************************************

but now i have another problem.

i would like to have a led that flashing but every arduino instruction to make a loop in switch case function (like for, while, an a variable that increases, etc) causes the problem "lost protocoll" in Race Coordinator!!!

any suggestions?
 

·
Premium Member
Joined
·
1,640 Posts
You'll need to set a flag that tells your code you want to flash the pin. Then in the "loop" function check the flag and if its set toggle the pin. The latest version of RC supports RGB Leds and it lets you flash LEDs under the yellow flag. No sketch changes required. You just wire the rgb leds, and configure them in RC. But of course you can't change their behavior so if you don't like how it works you can't use it...
 

·
Registered
Joined
·
14 Posts
in RC beta version I must use a RGB led or can I choose a normal led to blink with Yellow flag?

because in that case I must buy it

and what do you mean by flag? which type of instructions?

thanks
 

·
Premium Member
Joined
·
1,640 Posts
Only the RGB leds (neo pixels) support any kind of flashing. Like I said, you can use the built in RC support or code something yourself. That may all be more than you want to take on, but the support is there.

By flag I mean a boolean variable. You set it to true when you want the loop function to flash, and false when you do not. Then in the loop function you check it and either flash or not.
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #18 ·
i'll try to modify the sketch because i'd like to command an relay or a mosfet/transistor

thanks
 

·
Registered
Joined
·
14 Posts
Discussion Starter · #19 ·
i tryed this (loading this sketch in arduino the led on pin 13 blink immediately):

boolean ledState = false;

void setup() {
pinMode(13, OUTPUT);
}

void loop() {
delay(500);
ledState = !ledState;
digitalWrite(13, ledState);
}

i made the same setting and i put the code in case 5 (heat is paused) but the led is on and remain on untill next pause cycle (doesn't enter in the loop);

case 5:
// Heat is paused
delay(500);
ledState = !ledState;
digitalWrite(13, ledState);
break;

where am i wrong? (the declaration of boolean variable and void setup is the same of prevoius sketch example)
 
1 - 20 of 24 Posts
Top