Node on Raspberry pi running npm wiring-pi how to send bit codes?

379 views Asked by At

I'm currently trying to use node on a raspberry pi to host a HTTP server using socket.io to control it.

I currently have WASD keys binded to events ( forward, left, right, and back ) when I press the corresponding keys use light up LED's using code like this:

if( data.forward ) {
        console.log('forward - ON');
        wpi.digitalWrite(forwardPin, 1 );
    } else {
        console.log('forward - OFF');
        wpi.digitalWrite(forwardPin, 0 );
    }

This will turn off and on a LED. Now this is working, i want to now send hijack the controller of this tank i have bought.

Doing this my mimicking the signal the radio receiver sends out.

This guy has done this but in C : https://github.com/ianrenton/raspberrytank/blob/e311504642266d153ee434c85f91724a37403476/rt_ssh.c

You can see the codes in his code which are the same codes for my tank.

Here is one of them: int fwd_slow = 0xFE200F34;

I'm currently using this NPM module to control the GPIO pins (I'm totally open to other libs if you know better with better documentation).

Could someone show me a working example how to send "0xFE200F34" as a signal via a GPIO pin.?

Here is a link of his tutorial:
https://ianrenton.com/hardware/raspberry-tank/
I'm doing the same but in node only.

0

There are 0 answers