Skip to content

How master can recieve msg from slave ? #10

@yuranikspb

Description

@yuranikspb

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions