Back to Parent

//start

int buttonPin[9] = {D0, D1, A0, A1, A2, A3, A5, A6, A7};
int buttonRead[9] = {};

void setup()
{
  /*****************************/
  for(int i = 0; i < 9; i++)
  {
    pinMode(buttonPin[i], INPUT_PULLUP);
  }
  Spark.variable("state",&buttonRead[0],INT);
}

void loop()
{
  for(int i = 0; i < 9; i++)
  {
    buttonRead[i] = digitalRead( buttonPin[i] );

    if(buttonRead[i] == LOW)
    {
      //analogWrite(ledPin,255);
      //char buttonID = i;
      //String ix=sprintf("%u",i);
      String ix =  String(i);
      Spark.publish( "getTheCuteButton",ix);
      }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0