Pages: [1]
Author Topic: Sharing code for 4 bulbs and 7441s (C++)  (Read 4869 times)
pcairic
Newbie
*
Posts: 8


View Profile Email
« on: January 27, 2010, 01:17:38 AM »

It is possible to use the Arduinix with 7441 if you can't get hold of 74141 (or the russian equivalent).
Moreover, the sample code has been rewritten to use classes.

Comments welcome.

Enjoy!  Smiley

[code]//
// Arduinix 4 bulb
//
// This code runs a 4 bulb setup and displays a prototype clock setup.
// NOTE: the delay is setup for IN-8 nixie bulbs.
//
// by Jeremy Howa
// www.robotpirate.com
// www.arduinix.com
// 2008
//
// Rewritten from the robotpirate/arduinix 6 digit sample by Philippe Ca
Logged

pcairic
Newbie
*
Posts: 8


View Profile Email
« Reply #1 on: January 27, 2010, 01:30:59 AM »

Already a change, I tried to use the Time library, changes are as follow :

Code:
#include <Time.h>
...

void setup()
{
  // Setup is done entirely by the constructors

  // Initial time setup
  setTime(2, 30, 0, 27, 1, 2010); 
}


void loop()     

  // Get time in seconds 
  time_t time = now();
  clock << (hour(time) * 60 + minute(time)) * 60 + second(time);
}


For some reason, the code bloats by about 1500 bytes... Smiley

Next step is to plug in a DS1307.
Logged

Emblazed
Administrator
Newbie
*****
Posts: 23


View Profile Email
« Reply #2 on: January 27, 2010, 09:44:24 AM »

This is great stuff pcairic, may grab this code and sticky it with the other source.

Thanks for you work..

Emblazed.
Logged

pcairic
Newbie
*
Posts: 8


View Profile Email
« Reply #3 on: January 27, 2010, 10:59:46 AM »

There is a slight bug though. Correct CDisplay::operator << to read :
Code:
time_t operator << (time_t time)
  {
    // takes time in seconds and changes it to hours and minutes
    int iMinutes = minute(time);
    m_digit4 = iMinutes % 10; // last digit
    m_digit3 = iMinutes / 10; // first digit
    
    int iHours = hour(time);
    m_digit2 = iHours % 10;
    m_digit1 = iHours / 10;

    ...

And loop() to read:
Code:
void loop()    
{  
  clock << now();
}

In my enthusiasm, I forgot that we were back in the 80's with the int size...

Below the Arduino project file.

Philippe
« Last Edit: January 27, 2010, 11:10:19 AM by pcairic » Logged

Pages: [1]
Print
Jump to: