Sparkfun Joystick Shield

81,00 Lei   72,90 Lei
Stoc: 7
In stoc

Durata de livrare: 1 zi

Limita stoc
- +
Adauga in cos
Cod Produs: SHL-11 Ai nevoie de ajutor? 0731 007 832
Adauga la Wishlist Cere informatii
  • Descriere
  • Review-uri (1)

Shield Joystick pentru Arduino.

 

 

 

Exemplu:

 

char button0=3, button1=4, button2=5, button3=6;

char sel=2;

 

void setup(void)

{

  pinMode(sel, INPUT);      //Set the Joystick 'Select'button as an input

  digitalWrite(sel, HIGH);  //Enable the pull-up resistor on the select button

  

  pinMode(button0, INPUT);      //Set the Joystick button 0 as an input

  digitalWrite(button0, HIGH);  //Enable the pull-up resistor on button 0

 

  pinMode(button1, INPUT);      //Set the Joystick button 1 as an input

  digitalWrite(button1, HIGH);  //Enable the pull-up resistor on button 1

  

  pinMode(button2, INPUT);      //Set the Joystick button 2 as an input

  digitalWrite(button2, HIGH);  //Enable the pull-up resistor on button 2

 

  pinMode(button3, INPUT);      //Set the Joystick button 3 as an input

  digitalWrite(button3, HIGH);  //Enable the pull-up resistor on button 3

  

  Serial.begin(9600);           //Turn on the Serial Port at 9600 bps

}

 

void loop(void)

{

  Serial.print(analogRead(0));          //Read the position of the joysticks X axis and print it on the serial port.

  Serial.print(",");

  Serial.print(analogRead(1));          //Read the position of the joysticks Y axis and print it on the serial port.

  Serial.print(",");

  Serial.print(digitalRead(sel));       //Read the value of the select button and print it on the serial port.

  Serial.print(digitalRead(button0));   //Read the value of the button 0 and print it on the serial port.

  Serial.print(digitalRead(button1));   //Read the value of the button 1 and print it on the serial port.

  Serial.print(digitalRead(button2));   //Read the value of the button 2 and print it on the serial port.

  Serial.println(digitalRead(button3)); //Read the value of the button 3 and print it on the serial port.

  

  //Wait for 100 ms, then go back to the beginning of 'loop' and repeat.

  delay(100);

}

Linkuri:

Asamblare

Tutorial

Schema

Eagle

Exemplu Arduino

Ioan Popovici,

Cateva dintre linkurile de mai sus nu sunt corecte.

A fost util acest review?

Scrie un review


Suport clienti Magazinul este deschis luni - vineri, intre orele 11:00 si 17:00.

0731 007 832 contact@robofun.ro
close

Comparare

Trebuie sa mai adaugi cel putin un produs pentru a compara produse.

close

A fost adaugat in wishlist!

A fost sters din wishlist!