I am trying to find a way to get an Arduino to signal another Arduino when the first one is finished to start its code. Please let me know with any suggestions!
Depends on how far those two are away.
You could use Wlan modules and communicate via wireless.
You could use a single digital Output as a "switch" and connect other arduinos digital input via cable, read for, lets say, HIGH. When Digital Input is HIGH, then toggle the code in loop with a simple if.
I am afraid, you have to give more information, since your use case is too abstract to give a precise answer. There are possibilities though.
The goal is it will be in a Terminal style Exhibit so all devices will be close to each other so I could do the digital option with pin. I am staying away from wireless options as I need it to be as reliable as possible. So here is one of the codes
#include <Adafruit_NeoPixel.h>
int Pins[13] = {22,23,24,26,27,28,30,31,32,34,35,36}; //14 is A0
//int Pins[13] = {14,12,11,10,9,8,2,3,4,5,6,7}; //14 is A0
//int Sequence[12] = {1,0,1,0,1,1,0,1,1,0,0,1};
int Sequence[4][13] = { {1,0,1,0,1,1,0,1,1,0,0,1},
{1,1,0,0,1,1,0,1,1,1,0,0},
{1,0,1,0,0,1,0,1,1,0,1,1},
{0,1,1,0,1,0,1,0,0,1,1,0}};
int NeoPixel_Pin = 2; //15 is A1
int Relay_Pin = 4; //16 is A2
int Seq = 0;
int Reset_Pin = 3;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, NeoPixel_Pin, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(9600);
for(int x=0; x<13; x++) {
pinMode(Pins[x], INPUT_PULLUP);
}
pinMode(Relay_Pin, OUTPUT);
digitalWrite(Relay_Pin, LOW);
pinMode(Reset_Pin, INPUT_PULLUP);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
delay(500);
ResetMe();
}
void loop() {
if(digitalRead(Reset_Pin) == 0) {
ResetMe();
}
int Matched = 0;
for(int x=0; x<12; x++) {
if(1 - (digitalRead(Pins[x]) == Sequence[Seq][x])) {
Matched++;
}
}
//Matched = Matched - 1;
Serial.println(Matched);
if(Matched == 12) {
SuccessMe();
}
strip.show();
}
void SuccessMe() {
Serial.println("Success!");
digitalWrite(Relay_Pin, HIGH);
//delay(5000);
//ResetMe();
}
void ResetMe() {
Seq++;
if(Seq > 3) {
Seq = 0;
}
digitalWrite(Relay_Pin, LOW);
for(int x=0; x<13; x++) {
if(Sequence[Seq][x] == 0) {
strip.setPixelColor(x, strip.Color(127, 0, 0));
} else {
strip.setPixelColor(x, strip.Color(0, 127, 0));
}
}
strip.show();
Serial.println("Reset");
Serial.print("Next Sequence is: ");
Serial.println(Seq);
delay(1000);
}
Read the forum guidelines to see how to properly post code.
Please add your Code in [.Code.] taglines. (Without Points)
Thus being Said. Your best Bet ist communication via Pins, if it is just a simple toggling (Like Switch). For more complicated Data Transfer, Check serial Ports. When all of arduinos are going to be Close to each other, you can also controll all of your stuff from a Single arduino, when CPU Power ist enough for your application.
I need it to be as reliable as possible.
PS: i Wish, more escape room Designer would think Like that. Some dumbass thought it would be a fantastic Idea to integrate Shitty Augmented reality. Only 1 device for 4 people. 100€ down the drain. Never going to go there again.
Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code]
.
It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)
————-
"Close" is very relative... my friends live 100m down the road, I would say they are close to me, almost next door given the gardens... so how close is "close" for you?
There is another escape-room-mission for you: learning to program
Take a look into this tutorial:
It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.
best regards Stefan