Autonomo and Led Bar / Display issues

I have ordered a whole range of goodies and add-ons from Sodaq on my Autonomo board and I have gotten them all to work properly, except two:
The Grove LED bar and the Grove 4-digit display.

For both I just downloaded the libraries from Github and in my perception, you only need to change the port settings to get things running. with the example programs. However, that is not the case. The LED bar at least shows some signs of life, it sometimes turns at random times some random segments on, but the 4-digit display remains totally dark. I have tried all the digital ports on the Grove shield.

Does anyone know if the standard library needs to be tweaked for the Autonomo board, or if I am doing something else wrong?

Thanks for the help!

I can type a lot but maybe this helps more: http://www.instructables.com/id/4-Digit-Two-Wire-Display/

Unfortunately not. I have tried the suli library, as suggested in this example. Whereas the tm1637 library provided from seeed for the 4-digit display is nice and simple, the suli library is quite comprehensive and I can’t even get it to compile because of missing components.
Do you know if there are ready ‘out-of-the-box’ working examples for the Autonomo board for the display?

Using the “DigitalTube” library found here:
http://www.seeedstudio.com/wiki/File:DigitalTube.zip

The following sketch works correctly with the Autonomo:

#include "TM1637.h"
#define CLK 4 
#define DIO 5
TM1637 tm1637(CLK, DIO);

uint16_t count = 0;

void setup() 
{
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);
}

void loop() 
{
  tm1637.display(3, (count % 10));
  tm1637.display(2, ((count/10) % 10));
  tm1637.display(1, ((count/100) % 10));
  tm1637.display(0, ((count/1000) % 10));
 
  count++;
  delay(1000);
}

I believe there were a couple issues that were causing you problems. Several of the examples use another timer library that is probably not compatible with the SAMD platform. The “NumberFlow” example does work, however, the Grove socket it uses is on the SWITCHED side. In order to get it to work, you will have to switch on VCC_SW. Alternatively, you can use a set of pins on the ALWAYS ON side.

To switch on VCC_SW add these lines to your sketch prior to tm1637.init():

pinMode(VCC_SW, OUTPUT);
digitalWrite(VCC_SW, HIGH);

Thanks for the help!

I have gotten it to work now, also with some help from a test program found here:

That’s one down, now the LED BAR :smile:

The same should apply for the LED Bar.

They both use a custom communication method that requires 2 digital pins.

Try using pins 4,5 to start with, as they are on the ALWAYS ON side.

I have gotten the LED bar to work with a sample program that does not need any lib’s at all. Aparently the problem is partly due to the fact that the Grove LED bar hardware is v2.0 while the library provided by Seeed is still a lower version.
/*
* LED bar test program
*/
#define DATA_Pin 10 //DATA IN
#define CLK_Pin 11 //CLK IN
#define LED_pin 2
#define CmdMode 0x0000 //Work on 8-bit mode
#define ON 0x008f //8-bit 1 data, brightness 0x01…0xff
#define SHUT 0x0000 //8-bit 0 data

void send16bitData(unsigned int data)
{
  unsigned char i;
  boolean clk_pin_state;
 
  clk_pin_state = digitalRead(CLK_Pin);
  for(i=0;i<16;i++)
  {
      if(data & 0x8000) digitalWrite(DATA_Pin, HIGH);
      else digitalWrite(DATA_Pin, LOW);
      clk_pin_state = !clk_pin_state;
      digitalWrite(CLK_Pin, clk_pin_state); 
      data <<= 1;
      delayMicroseconds(1);
   }
}
 
//latch routine for MY9221 data exchange
void latchData(void)
{
   unsigned char i;
   boolean data_pin_state;
 
   digitalWrite(DATA_Pin, LOW);
   data_pin_state = LOW;
   delayMicroseconds(300);
   for(i=0;i<8;i++)
   {
     data_pin_state = !data_pin_state;
     digitalWrite(DATA_Pin, data_pin_state);
     delayMicroseconds(1);
   }
   delayMicroseconds(300);
}
 
void sendLED(unsigned int LEDstate)
{
  unsigned char i;
 
  for(i=0;i<12;i++)
  {
    if(LEDstate&0x0001)send16bitData(ON);
    else  send16bitData(SHUT);
    LEDstate >>= 1;
  }
}
 
void setup()
{
    pinMode(DATA_Pin,OUTPUT);   //Data pin
    pinMode(CLK_Pin,OUTPUT);  //CLK pin
    pinMode(LED_pin,OUTPUT);  //LED_pin
    digitalWrite(DATA_Pin, LOW);
    digitalWrite(CLK_Pin, LOW);
}
 
void loop()
{
  int tmpInt;
  while (1)
  { 
    for( tmpInt = 0; tmpInt < 10; tmpInt++ )
    {
      send16bitData(CmdMode); //set LED Bar mode
      sendLED(0x01<<tmpInt);
      latchData();  //make it come into effect
      delay(100);
    }
    for( tmpInt = 8; tmpInt >= 1; tmpInt-- )
    {
      send16bitData(CmdMode); //set LED Bar mode
      sendLED(0x01<<tmpInt);
      latchData();  //make it come into effect
      delay(100);
    }
  }
}