Help with Conversion From Arduino C to Propeller1 Spin
AwesomeCronk
Posts: 1,055
Hello, I am making progress with the issue described here.
I found some code to use these things with an Arduino, alongside pin definitions, and pinout diagrams. Can anyone here who uses the Prop1 and has Arduino experience please help me decipher this code?
I found some code to use these things with an Arduino, alongside pin definitions, and pinout diagrams. Can anyone here who uses the Prop1 and has Arduino experience please help me decipher this code?
#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> RF24 radio(7, 8); const byte rxAddr[6] = "00001"; void setup() { radio.begin(); radio.setRetries(15, 15); radio.openWritingPipe(rxAddr); radio.stopListening(); } void loop() { const char text[] = "Hello World"; radio.write(&text, sizeof(text)); delay(1000); }
#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> RF24 radio(7, 8); const byte rxAddr[6] = "00001"; void setup() { while (!Serial); Serial.begin(9600); radio.begin(); radio.openReadingPipe(0, rxAddr); radio.startListening(); } void loop() { if (radio.available()) { char text[32] = {0}; radio.read(&text, sizeof(text)); Serial.println(text); } }First chunk is transmitter, second chunk is receiver.
Comments
There are most likely objects in the OBEX to perform similar functions to the SPI.h, nRF24L01.h, and RF24.h code. Looking at the library code will also help.
I was using the text editor that comes with Linux Mint to paste the code you posted and add the comments so notepad should work.