Aduino to Raspberry Pi Troubleshoot
please me figure out why raspberry pi 3 not appear receiving signal aduino.
i have connected promicroto raspberry pi 3. wiring schematic attached.
aduino sending code
i getting random alternating current of less 3 volts ground pin 14 of promicro.
here rf sniffer code in raspberry pi:
the output raspberry pi looks rfsnifferresult attachment.
please me understand if raspberry pi not receiving signal or if aduino not sending signal.
i have connected promicroto raspberry pi 3. wiring schematic attached.
aduino sending code
code: [select]
#include <rh_ask.h>
#include <spi.h> // not used needed compile
rh_ask driver(2000, 2, 14, 5);;
void setup()
{
serial.begin(9600); // debugging only
if (!driver.init())
serial.println("init failed");
}
void loop()
{
serial.write("on");
const char *msg = "hey world!";
driver.send((uint8_t *)msg, strlen(msg));
driver.waitpacketsent();
delay(1000);
}
i getting random alternating current of less 3 volts ground pin 14 of promicro.
here rf sniffer code in raspberry pi:
code: [select]
/*
rfsniffer
usage: ./rfsniffer [<pulselength>]
[] = optional
hacked http://code.google.com/p/rc-switch/
by @justy provide handy rf code sniffer
*/
#include "../rc-switch/rcswitch.h"
#include <stdlib.h>
#include <stdio.h>
rcswitch myswitch;
int main(int argc, char *argv[]) {
// pin not first pin on rpi gpio header!
// consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/
// more information.
int pin = 2;
if(wiringpisetup() == -1) {
printf("wiringpisetup failed, exiting...");
return 0;
}
int pulselength = 0;
if (argv[1] != null) pulselength = atoi(argv[1]);
myswitch = rcswitch();
if (pulselength != 0) myswitch.setpulselength(pulselength);
myswitch.enablereceive(pin); // receiver on interrupt 0 => pin #2
while(1) {
if (myswitch.available()) {
int value = myswitch.getreceivedvalue();
if (value == 0) {
printf("unknown encoding\n");
} else {
printf("received %i\n", myswitch.getreceivedvalue() );
}
myswitch.resetavailable();
}
}
exit(0);
}
the output raspberry pi looks rfsnifferresult attachment.
please me understand if raspberry pi not receiving signal or if aduino not sending signal.
i read that, default serial pins in rpi configured terminal login. 1 need free pins before using them.
here 1 of tutorial explaining it http://www.hobbytronics.co.uk/raspberry-pi-serial-port
here 1 of tutorial explaining it http://www.hobbytronics.co.uk/raspberry-pi-serial-port
Arduino Forum > Using Arduino > Programming Questions > Aduino to Raspberry Pi Troubleshoot
arduino
Comments
Post a Comment