| Electronics > Beginners |
| Teensy 3.2, Turbine EDF27 and Turnigy Plush 6A speed controller |
| (1/1) |
| Nexo:
Hello everyone! I'm building a line following using a Teensy 3.2 (which can be programmed with the Arduino's IDE) and I want to implement the turbine showed below: Turbine EDF27: https://hobbyking.com/en_us/edf27-with-11000kv-motor-assembled.html Turnigy Plush: https://hobbyking.com/en_us/turnigy-plush-6a-8bec-6g-speed-controller.html Nothing I've found on forums seem to work so I'm here asking you guys. The code I show below is the one I'm using but is not working. A friend of mine connected a potentiometer and started moving it and the turbine worked but I don't know how to do it merely by code. Any idea will be very appreciated. Code: /* Coded by Marjan Olesch Sketch from Insctructables.com Open source - do what you want with this code! */ #include <Servo.h> int value = 0; // set values you need to zero Servo firstESC, secondESC; //Create as much as Servoobject you want. You can controll 2 or more Servos at the same time void setup() { firstESC.attach(6); // attached to pin 6 I just do this with 1 Servo Serial.begin(9600); // start serial at 9600 baud } void loop() { //First connect your ESC WITHOUT Arming. Then Open Serial and follow Instructions firstESC.writeMicroseconds(value); if(Serial.available()) value = Serial.parseInt(); // Parse an Integer from Serial } NOTE: I don't want it to vary its speed yet, I only want it to work at a set speed. Thanks in advance! |
| Nexo:
I've done it! I found a site where there was a code and used it: (Site: https://www.instructables.com/id/How-to-run-an-ESC-with-Arduino/) //This code can be used for any purpose. #include <Servo.h> Servo ESC1; int pos = 0; //Sets position variable void arm(){ setSpeed(0); //Sets speed variable delay(1000); } void setSpeed(int speed){ int angle = map(speed, 0, 100, 0, 180); //Sets servo positions to different speeds ESC1.write(angle); } void setup() { ESC1.attach(6); //Adds ESC to certain pin. arm(); } void loop() { int speed; //Implements speed variable for(speed = 0; speed <= 70; speed += 5) { //Cycles speed up to 70% power for 1 second setSpeed(speed); //Creates variable for speed to be used in in for loop delay(1000); } delay(4000); //Stays on for 4 seconds for(speed = 70; speed > 0; speed -= 5) { // Cycles speed down to 0% power for 1 second setSpeed(speed); delay(1000); } setSpeed(0); //Sets speed variable to zero no matter what delay(1000); //Turns off for 1 second } I hope it helps someone. Have a great day! |
| Leev:
Hey! Can confirm this code works with my particular ESC. Was having problems arming a Turnigy ESC Plush30a for a brushless motor before running this code. I added a longer delay at the start which also may have given my ESC enough time to arm. void arm(){ setSpeed(0); //Sets speed variable delay(8000); } Thanks to Nexo for the help. If you ever come to Australia I'll shout you a beer :) |
| Nexo:
Glad it worked for you! Looking forward to that beer ;D |
| Navigation |
| Message Index |