Some new stuff
  1. Arduino Park Control
  2. Arduino USB2serial programming the bare bone
  3. Arduino Projects Videos added
  4. Arduino Xbee projects
  5. Arduino dB Meter 
  6. Trying to get the IOIO going. 
  7. IOIO is going....bluetooth
  8. Attiny 2313 bluetooth bee RC car
  9. Compass and temperature added
  10. AVR programmer
  11. USB2Serial and Ethernet POE
  12. Arduino LPG Sensor
  13. Program the Arduino Mini 05
  14. Lipo Rider Pro in action
  15. EZ Robot Builder kit arrived 10 Nov 2012
  16. Arduino VA Meter!
  17. 05 Nov 2012 Project Sentry Gun.
  18. Attiny85 PIR Sensor 10 Dec 2012 
  19. 0-30VDC3A and 2-28VDC10A bench PSU's
  20. 19 Dec 2012 Arduino Voltmeter LCD
  21. 29 Dec 2012 Arduino Tachometer&Speedometer LCD
  22. 03 Jan 2013 Arduino AC Phase Control. 
  23. 18 Jan 2013 Arduino Distance Meter
  24. 22 Jan 2013 Arduino Digital Clock and Date
  25. 31 Jan 2013 Arduino Digital Clock and Date 8x2 LCD
  26. Feb 2013 LCD and Backpack
  27. Feb 2013 7 Segment Serial Clock Sparkfun. Distance Sensor with "newping" library
  28. Feb 2013 Lelo Remote
  29. 01/03/2013 Arduino Adafruit 7 Seg Digital Clock with RTC and backpack 
  30. Arduino Frequency Meter 26/03/2013
  31. Another RC  Car controlled by Arduino 06/04/2013
  32. My quadcopter project update 25 April 2013
  33. My Aqua Quad Copter Flying 26 April 2013enlightened
  34. Another monster RC truck;strong one! 11July2013cool
  35. X-Frame Quad Copter 31 July 2013cool
  36. Arduino GSM Sheild added.28/8/2013
  37. 1.8inch TFT screen 13/09/2013cool
  38. 04/11/2014 added PID Soldering Iron Control
  39. Added bluetooth servo control 04/11/2014
  40. ESP8266 first try.16/03/2015
  41. Arduino Uno Quadcopter 19 May 2015
  42. IOT WemosD1 Amp Meter

 

 


Search    

ArduinoTGY 9X Servo Control 

RX = Flysky or similar

The project is from Leonvanderhosrt.nl.

I only changed the code slightly to accommodate the adafruit backpack 16x2 LCD.

Also I changed some of the characters on LCD.

Video HERE

Code:

#include "Wire.h"
#include "LiquidCrystal.h"
LiquidCrystal lcd(0);
#include  
Servo servoBB;         // create servo object to control a servo
Servo servoBO;         // create servo object to control a servo
Servo servoSB;         // create servo object to control a servo
Servo servoSO;         // create servo object to control a servo

int ServoBBPort = 9;   // digital port where servo is attached to
int ServoBOPort = 10;  // digital port where servo is attached to
int ServoSBPort = 5;   // digital port where servo is attached to
int ServoSOPort = 6;   // digital port where servo is attached to
int pos = 0;           // variable to store the servo position  

unsigned long RCchannel1 = 0;    // variable to store pulse width data in from RC receiver channel 1
int RCPort1 = 14;       // port (14 = analog 0) where RC channel 1 is attached to

byte smiley[8] = {B00000, B10001, B00000, B00000, B10001, B01110, B00000,};

byte cry[8] = {B00000, B10001, B00000, B00000, B01110, B10001, B00000,};

void setup() {
  lcd.begin(16, 2);              // set up the LCD's number of rows and columns: 
  lcd.print("chemcool.co.za ");
  servoBB.attach(ServoBBPort);   // attaches the servoBB to the servo object 
  servoBO.attach(ServoBOPort);   // attaches the servoBO to the servo object 
  servoSB.attach(ServoSBPort);   // attaches the servoSB 9 to the servo object 
  servoSO.attach(ServoSOPort);   // attaches the servoSO 9 to the servo object 
  servoBB.write(90);             // set servoBB in neutral
  servoBO.write(90);             // set servoBO in neutral
  servoSB.write(90);             // set servoSB in neutral
  servoSO.write(90);             // set servoSO in neutral
  pinMode(RCPort1, INPUT); delay(3000);
  lcd.clear(); lcd.print("    CHEMCOOL");
  lcd.createChar(0, smiley);
  lcd.createChar(1, cry);
  lcd.setCursor(0, 1);           // set the cursor to column 0, line 1 - (note: line 1 is the second row, since counting begins with 0)
}


void loop() {
  RCchannel1 = pulseIn(RCPort1, HIGH, 20000);           // get pulse from RC receiver channel 1
  if (RCchannel1 < 900 || RCchannel1 > 2150)
  {
    lcd.setCursor(0,1); lcd.print("   No signal!   ");
    lcd.setCursor(15,0); lcd.write(1);                  // print sad face in top right corner on LCD display
    pos = 90;
  }
   else
  {
    pos=map(RCchannel1, 1000, 2000, 65, 115);           // translate pulses from rc receiver to servo degrees
    lcd.setCursor(15,0); lcd.write(0);                  // print smiley in top right corner on LCD display
    lcd.setCursor(0,1); lcd.print("Rec=     Srv=   ");  // set cursor at first column at second line on LCD display
    lcd.setCursor(4,1); lcd.print(RCchannel1);          // print pulse value on LCD display
    lcd.setCursor(13,1); lcd.print(pos);                // print degrees value for servo on LCD display
  }
  servoBB.write(pos);                                   // tell servo to go to position in variable pos 
  servoBO.write(pos);                                   // tell servo to go to position in variable pos 
  servoSB.write(pos);                                   // tell servo to go to position in variable pos 
  servoSO.write(pos);                                   // tell servo to go to position in variable pos 
  delay(200);                                           // waits for the servo to reach the position    
}

 

 

 

Back Back to top