Skywriter with Arduino: Getting started problems

Hello

I’m trying to run the big Skywriter (not the HAT) with an Arduino Uno without success.
I installed the Skywriter Arduino library from github and tried the examples, but the Skywriter doesn’t do anything. There’s no error message, but Skywriter.onXYZ() or Skywriter.onGesture() are never called.

As there is very few instruction and no control LED on the Skywriter, I’m not sure if I connected everything the right way.
I connected Arduinos 5V and GND with Skywriters Vcc and GND, and the TRFR and RESET pins to Arduino pins 4 and 5 and declared them with Skywriter.begin(4, 5);.
There’s no word about the SDA and SCL pins, but I figured I have to connect them to the SDA and SCL pins on Arduino. But still no reaction at all. The serial monitor shows that Skywriter.onXYZ() is never called.
What am I missing? Or is it broken?

As I said, I miss the manual. Especially about hooking it up with an Arduino. I don’t even know which side of the Skywriter is the sensor side.

Thank you for helping,
Daniel

Ahoy! Sorry for the lack of documentation- I focussed a little heavily on the Pi side of things there.

I don’t have a Skywriter to hand to walk you through some debugging steps right now, but a good place to start is always the Arduino I2C scanner, to check whether or not the sensor is responding/wired up correctly: http://playground.arduino.cc/Main/I2cScanner

Hi,
I have the same problem. Skywriter not work with Arduino.
Please show a working example.

Thanks in advance

Using the library in our GitHub repository ( https://github.com/pimoroni/skywriter-hat/tree/master/arduino ) , and the code below, I tested a Skywriter successfully:

#include <Wire.h>
#include <skywriter.h>

unsigned int max_x, max_y, max_z;
unsigned int min_x, min_y, min_z;

void setup() {
  Serial.begin(9600);
  Serial.println("Hello world!");
  
  Skywriter.begin(12, 13);
  Skywriter.onTouch(touch);
  Skywriter.onAirwheel(airwheel);
  Skywriter.onGesture(gesture);
  Skywriter.onXYZ(xyz);
}

void loop() {
  Skywriter.poll();
}

void xyz(unsigned int x, unsigned int y, unsigned int z){
  if (x < min_x) min_x = x;
  if (y < min_y) min_y = y;
  if (z < min_z) min_z = z;
  if (x > max_x) max_x = x;
  if (y > max_y) max_y = y;
  if (z > max_z) max_z = z;
  
  char buf[64];
  sprintf(buf, "%05u:%05u:%05u gest:%02u touch:%02u", x, y, z, Skywriter.last_gesture, Skywriter.last_touch);
  Serial.println(buf);
}

void gesture(unsigned char type){
  Serial.println("Got gesture ");
  Serial.print(type,DEC);
  Serial.print('\n');
}

void touch(unsigned char type){
  Serial.println("Got touch ");
  Serial.print(type,DEC);
  Serial.print('\n');
}

void airwheel(int delta){
  Serial.println("Got airwheel ");
  Serial.print(delta);
  Serial.print('\n');
}

This is with TRFR connected to Arduino Pin 12 and Reset connected to Arduino Pin 13. The SDA/SCL pins ( marked underneath my Arduino UNO ) are just to the left.

Hi @gadgetoid and all,

I am also having some trouble with the skywriter. I tried the above code, but my serial output gives me:

Hello world!
Got touch 
11
Got touch 
6
Got touch 
12
Got touch 
7
Got touch 
14
Got touch 
9

And so on, touching left bar, right bar, bottom bar. Nothing on the main area, no “Airwheel”, no gesture recognition.

Any insight is well appreciated :)

Best regards Frederik

[edit]
Might be firmware related as in this post?
http://forums.pimoroni.com/t/solved-fullsized-skywriter-problem/950/2

For the record: After firmware upgrade, everything works nicely.
Polling is really fast!

Thanks @gadgetoid

1 Like

Yay! Glad you could fix it yourself, and that it was a learning experience!