Skip to content

Welkom op onze vernieuwde webshop! Loop je ergens tegenaan of mis je iets? Laat het ons weten via info@benselectronics.nl

Joystick module

Article number C28

€1.49Was €2.49Sale−40%Incl. VAT€1.23 excl. VAT

In stock

  • Free shipping from €100 (Netherlands/Belgium)
  • Shipped from our own warehouse in the Netherlands

Joystick module met twee potentiometers. ( 10 KOhm )

Test Sketch:

int value = 0;

void setup() {
	//pinMode(A0, INPUT);
	//pinMode(A1, INPUT);
  	pinMode(7, INPUT_PULLUP); //set pin 7 as an input and enable the internal pull-up resistor
	Serial.begin(9600);
}

void loop() {
  value = analogRead(A0);	// read X axis value [0..1023]
  Serial.print("X:");
  Serial.print(value, DEC);

  value = analogRead(A1);	// read Y axis value [0..1023]
  Serial.print(" | Y:");
  Serial.print(value, DEC);

  value = digitalRead(7);	// read Button state [0,1]
  Serial.print(" | Button:");
  Serial.println(value, DEC);

  delay(100);
}