スポンサーリンク

I can now draw handwritten pictures on electronic paper using the Nintendo DS touch panel

スポンサーリンク

The Nintendo DS touch panel can be used with e-paper.

スポンサーリンク

Touch Panel

I bought a large DSi LL touch panel on Amazon.Since the connector part is very small and special, I bought an additional 0.5mm pitch 4-pin FFC conversion board at “aitendo”.

Program

On the four pins coming out of the panel, the voltage of another pin is converted from analog to digital while the GPIO turns it high or low.By trial and error, I managed to calculate the coordinates of the touches.

void loop()
{
  int x = 0, y = 0;
  pinMode(touch_digital_x, OUTPUT);
  digitalWrite(touch_digital_x, HIGH);
  pinMode(touch_digital_nx, OUTPUT);
  digitalWrite(touch_digital_nx, LOW);
  pinMode(touch_digital_y, INPUT);
  pinMode(touch_digital_ny, INPUT);
  delay(2);
  digitalWrite(4, HIGH);
  x = analogRead(touch_analog_y);
  digitalWrite(4, LOW);

  pinMode(touch_digital_y, OUTPUT);
  digitalWrite(touch_digital_y, HIGH);
  pinMode(touch_digital_ny, OUTPUT);
  digitalWrite(touch_digital_ny, LOW);
  pinMode(touch_digital_x, INPUT);
  pinMode(touch_digital_nx, INPUT);
  delay(2);
  digitalWrite(4, HIGH);
  y = analogRead(touch_analog_x);
  digitalWrite(4, LOW);

  x = map(x, 130, 3000, 0, 800);
  y = map(y, 240, 3000, 0, 600);

  px = nx;
  py = ny;
  if (x > 0 && y > 0) {
    nx = x;
    ny = y;
  } else {
    nx = x;
    ny = y;
000000px = nx;
000000py = ny;
  }
  Serial.println();
  Serial.println("x:" + String(x));
  Serial.println("y:" + String(y));
}

If you run it, you will get the coordinates like this.

スポンサーリンク

Draw it

The touch panel is quite interesting.

コメント