Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How master can recieve msg from slave ? #10

Open
yuranikspb opened this issue Jan 19, 2018 · 0 comments
Open

How master can recieve msg from slave ? #10

yuranikspb opened this issue Jan 19, 2018 · 0 comments

Comments

@yuranikspb
Copy link

yuranikspb commented Jan 19, 2018

I have problem
i am create test project in proteus
1213123
Master:
` #include <ICSC.h>
const int buttonPin = 3;
const int ledPin = 4;
const int portreadyled = 5;
const int dePin = 2;
int buttonState = 0;
ICSC icsc(Serial,'A',dePin);

void setup() {
// put your setup code here, to run once:
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize the LED as an output:
pinMode(ledPin, OUTPUT);
pinMode(2,OUTPUT);
Serial.begin(9600);
icsc.begin();
icsc.registerCommand('G',&check);
delay(2000);
digitalWrite(ledPin, HIGH);
delay(100);
icsc.send('B', 'S');

}

void loop() {
icsc.process();
}
void check(unsigned char src, char command, unsigned char len, char *data)
{
digitalWrite(ledPin, LOW);

} `

Slave :
` #include <ICSC.h>
#include <String.h>
const int buttonPin = 3;
const int ledPin = 4;
const int dePin = 2;
int buttonState = 0;

ICSC icsc(Serial,'B',dePin);
void setup() {
// put your setup code here, to run once:
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize the LED as an output:
pinMode(ledPin, OUTPUT);
pinMode(2,OUTPUT);
Serial.begin(9600);
icsc.begin();
icsc.registerCommand('S',&stat);
}
void loop() {

icsc.process();

//icsc.send('A', 'G');
}
void stat(unsigned char src, char command, unsigned char len, char *data)
{

delay(1000);
for (int i=0; i <= 15; i++){
icsc.send('A', 'G');
icsc.process();
delay(50);
}

} `
Algorithm:
master send to slave command and led is high
slave recieve command wait and 15times try send to master command for led is LOW

master react only on 5
why ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant