RC Motorvezérlő irányítás

Processing/Wiring (illetve C) nyelvű programozási fogások, tippek. (AVR-Duino, Arduino, EthDuino, Diecimila, Severino, Nano, LilyPad)
Válasz küldése
Zack
DrótVégénSzéndarab
Hozzászólások: 38
Csatlakozott: 2013. december 27. péntek, 13:22

RC Motorvezérlő irányítás

Hozzászólás Szerző: Zack »

Sziasztok!
Hogyan továbbíthatok egy RC motorvezérlőnek jelet az arduinoval?
Láttam róla rengeteg youtube videót amin szimplán egy servo függvényt használnak és ezzel irányítják a motort, na de nekem erre nem reagál semmit.
Valaki jártas ebben?
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10213
Csatlakozott: 2005. december 9. péntek, 7:00

Re: RC Motorvezérlő irányítás

Hozzászólás Szerző: Robert »

Mid Van ?
Mire jutottál eddig?

Amit megadtál igen kevés információ: TE vagy előtte, TE tudod, mit szeretnél. Kérlek írdd le _részletesebben_.
Én pl. MobilGSM átvitellel vagy BlueTooth kapcsolattal is elvezérelgetek szervo-t. Gondolom ez nem jó, pedig az alapkérdésedre megoldás.
Zack
DrótVégénSzéndarab
Hozzászólások: 38
Csatlakozott: 2013. december 27. péntek, 13:22

Re: RC Motorvezérlő irányítás

Hozzászólás Szerző: Zack »

A motorvezérlőt összekapcsoltam az arduinoval, ha bekapcsolom az arduinot akkor érzékeli a jelet(csipog egyet, és bekapcsol. Ha nemlenne jel akkor folyamatában csipogna), de utána hiába akarok kiíratni vele bármit is semmi nem történik.
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10213
Csatlakozott: 2005. december 9. péntek, 7:00

Re: RC Motorvezérlő irányítás

Hozzászólás Szerző: Robert »

Ok:Protokoll, típus, fénykép, bármi? Motorvezérlő + RC kifejezésre a google képek közt >10.000 találatot ad.
Had ne barchóbázzunk :)
Zack
DrótVégénSzéndarab
Hozzászólások: 38
Csatlakozott: 2013. december 27. péntek, 13:22

Re: RC Motorvezérlő irányítás

Hozzászólás Szerző: Zack »

E: SIKERÜLT!
Neten találtam egy használható kódot amit kicsit átalakítottam és működik :D

Kód: Egész kijelölése

/*
*  This code is in the public domain.
*  (Do whatever you want with it.)
*/

// Need the Servo library
#include <Servo.h>
int ch;

// This is our motor.
Servo myMotor;

// This is the final output
// written to the motor.
String incomingString;


// Set everything up
void setup()
{
  // Put the motor to Arduino pin #9
  myMotor.attach(9);

  // Required for I/O from Serial monitor
  Serial.begin(9600);
Serial.setTimeout(50);
  // Print a startup message
  Serial.println("initializing");
}


void loop()
{
  // If there is incoming value
  if(Serial.available() > 0)
  {
    // read the value
   ch = Serial.parseInt();
  
    /*
    *  If ch isn't a newline
    *  (linefeed) character,
    *  we will add the character
    *  to the incomingString
    */
      // print the incoming string
      Serial.println("I am printing the entire string");
      Serial.println(ch);
    
      // Convert the string to an integer
      int val = ch;
    
      // print the integer
      Serial.println("Printing the value: ");
      Serial.println(val);
    
      /*
      *  We only want to write an integer between
      *  0 and 180 to the motor. 
      */
      if (val > -1 && val < 181)
     {
       // Print confirmation that the
       // value is between 0 and 180
       Serial.println("Value is between 0 and 180");
       // Write to Servo
       myMotor.write(val);
     }
     // The value is not between 0 and 180.
     // We do not want write this value to
     // the motor.
     else
     {
       Serial.println("Value is NOT between 0 and 180");
      
       // IT'S a TRAP!
       Serial.println("Error with the input");
     }
}
Válasz küldése