
DIY Transmitter 3 Channel
STDDIY Transmitter 3 Channel
706
0
0
0
Mode:Full
License
:Creation time:2022-01-08 02:41:19Update time:2022-01-21 17:38:31
Description
Transmitter Code:
// 3 Channel Transmitter #include #include #include const uint64_t pipeOut = 0xE9E8F0F0E1LL; // Match key RF24 radio(9, 10); // Select CE,CSN pin struct Signal { byte throttle; byte steering; byte aux1; }; Signal data; void ResetData() { data.throttle = 127; // Motor stop (Signal lost position) data.steering = 127; // Center (Signal lost position) data.aux1 = 0; // (Signal lost position) } void setup() { //Start everything up radio.begin(); radio.openWritingPipe(pipeOut); radio.setAutoAck(false); radio.setDataRate(RF24_250KBPS); radio.setPALevel(RF24_PA_MAX); radio.stopListening(); //start the radio comunication for Receiver ResetData(); } // Joystick center and it's borders int mapJoystickValues(int val, int lower, int middle, int upper, bool reverse) { val = constrain(val, lower, upper); if ( val < middle ) val = map(val, lower, middle, 0, 128); else val = map(val, middle, upper, 128, 255); return ( reverse ? 255 - val : val ); } void loop() { // Control Stick Calibration // Setting may be required for the correct values of the control levers. data.steering = mapJoystickValues( analogRead(A0), 200, 460, 650, true ); // "true" or "false" for servo direction data.throttle = mapJoystickValues( analogRead(A1), 200, 440,670, true ); // "true" or "false" for signal direction data.aux1 = digitalRead(4); radio.write(&data, sizeof(Signal)); }
Design Drawing

BOM


Add to Album
0
0
Share
Report
Project Members
Followers0|Likes0
Related projects

Comment