Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

I am trying to create a communication between arduinos with NRF24 modules and IR Infrared Obstacle Avoidance Sensors, I have communication between the two arduinos,

I am trying to create a communication between arduinos with NRF24 modules and IR Infrared Obstacle Avoidance Sensors, I have communication between the two arduinos, but I cannot code the part with the IR Infrared Obstacle Avoidance Sensor Module to turn on and off a led when the sensor detects the present of an object.

Here is the code that I have: I have the transmitter and the receiver code below

Transmitter #include #include #include #include const int pinCE = 9; const int pinCSN = 10; RF24 radio(pinCE, pinCSN); // Single radio pipe address for the 2 nodes to communicate. const uint64_t pipe = 0xE8E8F0F0E1LL; char data[16]="Hi world" ; void setup(void) { pinMode(7,INPUT); radio.begin(); radio.openWritingPipe(pipe); } void loop(void) { radio.write(data, sizeof data); delay(1000); unsigned long irV = digitalRead(7); } Receiver #include #include #include #include const int pinCE = 9; const int pinCSN = 10; RF24 radio(pinCE, pinCSN); // Single radio pipe address for the 2 nodes to communicate. const uint64_t pipe = 0xE8E8F0F0E1LL; char data[16]; void setup(void) { Serial.begin(9600); radio.begin(); radio.openReadingPipe(1,pipe); radio.startListening(); } void loop(void) { if (radio.available()) { radio.read(&data, sizeof(data));

Serial.println(data); } }

if (radio.available() && digitalRead(7)==0) { radio.read(&data, sizeof(data));

Serial.println(data); digitalWrite(4,HIGH); digitalWrite(4,LOW); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students explore these related Databases questions

Question

How does memory change with agepg12

Answered: 3 weeks ago

Question

Types of physical Maps?

Answered: 3 weeks ago