C RbPi UART Remote Control Sockets -


i want remote control sockets in room manual without library on raspberry pi. want use uart interface in c. socket has 433 mhz receiver , use 433 mhz transmitter. in other librarys type this: send 11111 1 1. (socket code, socket number, condition). how format command in c write() function? 10 number of characters. use code below. tested output via minicom, works fine. how receiver knows adressed?

#include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h>  int main(int argc, char ** argv) {   int fd;   // open port. want read/write, no "controlling tty" status, , open i$   fd = open("/dev/ttyama0", o_rdwr | o_noctty | o_ndelay);   if (fd == -1) {     perror("open_port: unable open /dev/ttyama0 - ");     return(-1);   }    // turn off blocking reads, use (fd, f_setfl, fndelay) if want   fcntl(fd, f_setfl, 0);  // write port   int n = write(fd,"11111 1 1",10);   if (n < 0) {     perror("write failed - ");     return -1;   }    // don't forget clean   close(fd);   return 0; } 

do right: send command via uart transmit message via radio trasmitter. sniffing uart output proves code ok in sense tx line sends want send in software, , actual question "how rx module gets message/how make rx module it?"

if so, main question kind of radio tx/rx or trxs use (i mean chip/module codes, cc1120, nrf2401 etc.)? there plenty of 433mhz radiomodules available, suppose consulting datasheet first or @ least posting part number here right way go.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -