Pages: [1]   Go Down
Author Topic: Irremote problem  (Read 9826 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tjena, försöker lösa problemet med att använda en ir controll för att styra servo. Använder en arduino uno rev 3

detta är vad jag gjort.


Code:
#include <Servo.h>
    #include <IRremote.h>

    unsigned long Value1 = 0xFFA25D; // where XXXXXXXX is on our your remote's values
    unsigned long Value2 = 0xFF629D; // where XXXXXXXX is another button on your remote

    int RECV_PIN = 11;
    IRrecv irrecv(RECV_PIN);
    decode_results results;

    Servo servo1;

    // the setup routine runs once when you press reset:
    void setup() {            

    Serial.begin(9600);
      irrecv.enableIRIn(); // Start the receiver

      // initialize the digital pin as an output.

    servo1.attach(10); // attack servo to digital pin 10
    }

    // the loop routine runs over and over again forever:
    void loop() {

    if (irrecv.decode(&results)) {
        Serial.println(results.value, HEX);
        irrecv.resume(); // Receive the next value
      }

    if(results.value == Value1) {
    servo1.write(160);
    }
    else if  (results.value == Value2){
    servo1.write(75);
    }
    }  

Jag vill kunna få hjälp med att förstå vart koderna man får av IR recivern ska in.
tacksam för all svar.
« Last Edit: January 25, 2014, 05:51:31 pm by kamokaki » Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 32
Posts: 1211
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"funkar inte" - du får fel i kompilering eller Serial siger rigtigt värde men servoen rör sig inte eller vad ?

Beskriv hvad du hoppas skal hända och vad som faktisk händer
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1063
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@kamokaki

Det er ikke populært at stille samme spørgsmål i flere sub-fora

http://forum.arduino.cc/index.php?topic=212568.msg1557980#msg1557980
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 301
Posts: 26220
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1) code tags. Use them
2) auto format. Use it.
3) serial debug output. Post it.
4) cross post. Don't do it.
« Last Edit: January 25, 2014, 05:03:46 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im sorry but I dont really undestand.. I found most of the code online so can you somhow answer easier in a way someone new would understand.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Vad jag inte förstår är vart man ska sätta in värdet man får när man trycker på kontrollen och får koderna den ger av.
Anledningen till att jag skrev två olika forum är att det kanske bli enklare att förstå det på svenska då jag är en nybörjare.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 301
Posts: 26220
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I dont really undestand
Use code tags. It avoids the possibility of the forum mangling your code.
Use auto format. It makes you code easier to read.
You have debug prints in your code. Show us the output.
Don't cross-post. What more can I say?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ohh ok. cross post. I did one because its a scandinavian so people reading there could help me out.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 301
Posts: 26220
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

more
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

East Anglia (UK)
Online Online
Faraday Member
**
Karma: 114
Posts: 4240
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What does happen when you run the program ?
Where does the servo get its power from ?
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well the servo is attached to the 5v output. Its a rather small servo that you get in a arduino kit.
Then i also have a reciver and a tiny remote included.
I have downloaded the IRREMOTE file from ken shiriff blog witch enables me to connect the reciver and type in the buttons to get the codes and raw from it.
What Ive been trying to explain is that I want to move the servo from a sertain degree to another by pressing the remote.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 301
Posts: 26220
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What I've been trying to explain is we can't see what you you can see.
Good luck.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: