So I had a setup where I had an R9DS RC receiver connected to a Librepilot CC3D with SBUS and I wanted to control two servos with an accessory channel switch on my transmitter. I needed the servos to trigger, but reversed to each other when I flipped the accessory switch on. I figured out it was pretty impossible to do on the CC3D, so here’s how I did it with an arduino nano. NOTE: The exact method I used only works when your receiver can output the channel on SBUS and PWM simultaneously, the arduino will listen to PWM.
byte PWM_PIN = 3;
int pwm_value;
void setup() {
pinMode(PWM_PIN, INPUT);
Serial.begin(115200);
}
void loop() {
pwm_value = pulseIn(PWM_PIN, HIGH);
Serial.println(pwm_value);
//delay(500);
}Now you can determine what state the remote acessory switch is in with pulseIn. Here’s my use case:
{
#include <Servo.h>
Servo LeftServo; // create servo object to control a servo
Servo RightServo;
void setup() {
pinMode(3, INPUT);
LeftServo.attach(9); // attaches the servo on pin 9 to the servo object
RightServo.attach(10);
}
void OperateJaw(bool isOpen)
{
if(isOpen)
{
LeftServo.write(180);
RightServo.write(0);
}
else
{
LeftServo.write(0);
RightServo.write(180);
}
}
int pwm_value;
void loop() {
pwm_value = pulseIn(3, HIGH);
if(pwm_value > 1200)
openState = false;
else
openState = true;
OperateJaw(openState);
}I have two computers at college, my custom desktop, and my laptop. Both are running Windows 10, but what’s important to this guide is the desktop is running Windows 10 as the client configuration here is trivial to replicate on OSX or Linux, probably even easier. The desktop is definitely the powerhouse, and I do all of my heavier applications and processing on it. However, I’m out and about on campus most of the day, and am sometimes unable to access my desktop when I need to. I was reluctant to just open up RDP on my firewall given the security risks, and I thought setting up a personal VPN to access one port on one computer would be overkill, so I decided to go with SSH port forwarding.
The sshd_config file on windows is located at %programdata%\ssh\sshd_config
I recommend adding this line: PasswordAuthentication no to disable less secure password authentication and only rely on more secure pub/priv keys. If you do this, run ssh-keygen on the client, go to %userprofile%\.ssh, and copy the contents of the id_rsa file on the client to a file on the server in the same location called authorized_keys.
You can change the port from 22 if you want security through obscurity with this line in sshd_config: Port [port number]
Make sure to allow the port through on your firewall and forward through your router if necessary.
$ArgumentList = '-L 4000:localhost:3389 ' + $content + ' -p 31825'
Start-Process ssh -ArgumentList $ArgumentList -NoNewWindow
Start-Sleep 5
mstsc /v localhost:4000
wait-process -name mstsc
exit
2018 was a big year for me. It was a year of firsts and lasts, of learning and growing, and one full of highs and lows and everything in between.
read more