Benito Sanguino Arduino.


For a while now I have wanted to check out the sanguino project (www.sanguino.cc) firsthand. I wanted to see this thing that I had tried half heartedly to work out a couple of times in the past year and a half (i.e. running the arduino code on the atmega 644) actually running. I also wanted to test the benito against a new board and I wanted to revive the “MegMouse” boards I did over a year ago to control a couple of maze solving robots.

So I went to the Wulfden FreeDuino Shop Wulfden FreeDuino Shop (www.wulfden.org/TheShoppe/freeduino/) for one of his new Sanguinos. I assembled it (more or less) in a few hours at a friends house last week but then didnt ge’t the cable made for it until yesterday.

In the mean time I downloaded arduino 12 and the new “core” provided byt the sanguino team. After adding the new section to the boards.txt like the documentation said to do I selected the new board from the tools menue. When you change boards the arduino compiles its libraries against the new processor. This is outside of the core and the new Servo library would not compile. It was an easy fix though adding the new processor to the code distinguishing the mega8 timer register names from the mega168. The next time I went back to the sanguino site a new version already addressed this issue. I suspect as the 328s become readily avaliable some of these issues will get resolved within the arduino team itself.

Finally I was able to build out the cable for the benito.

The pinouts for thos inquiring minds go like this.

I still havent gotten used to the idea that red is the right color for the debug leds (green is for power) so I put mine in wrong (the power led is also backwards so it doesnt glow) but once I changed the code led from pin 13 to pin 0 “blink” blinked.

Then I went to the first thing that I could find that required more pins to drive then the arduino had. I pulled an old led display out of the junk heap. There were 15 segments on 7 digits(22 pins).

/*
 * Bad coder no docs / copyleft here...
 */
#define NSEGMENTS 15
#define NDIGITS 7
#define BLANK 36
int ledPin = 0;
//                   a, b, c, d, e, f, g, h, j, k, l, m, n, p,dp
int SegmentPin[] = {30,31, 2, 7, 5, 1,28,25,29,27, 4, 6,26,24, 3};
int DigitPin[] = {15,16,17,18,21,20,19};
char charmap[][14]={
 //a,b,c,d,e,f,g,h,j,k,l,m,n,p
  {0,0,0,0,0,0,1,0,1,1,1,0,1,1}, //0
  {1,1,1,1,1,1,0,1,1,1,0,1,1,1}, //1
  {0,0,1,0,1,1,1,1,0,1,1,0,1,1}, //2
  {0,1,0,0,1,1,1,0,0,1,1,1,1,1}, //3
  {1,0,0,1,1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1,0,1,1,0,1,1,0}, //Y
  {0,1,1,0,1,1,1,0,1,1,1,0,1,1}, //Z
  {1,1,1,1,1,1,1,1,1,1,1,1,1,1}, //
  {1,1,1,1,1,1,1,1,1,1,1,1,1,1}

};

char ascii2charmap (char ac) {
  if (ac>'z') return BLANK;
  if (ac>='a') return ((ac-'a')+10);

  if (ac>'Z') return BLANK;
  if (ac>='A') return ((ac-'A')+10);
  if (ac>'9') return BLANK;
  if (ac>='0') return (ac-'0');
}


void setup()                    // run once, when the sketch starts
{ int i;
 for (i=0;i<NSEGMENTS;i++) {
  pinMode(SegmentPin[i], OUTPUT);      // sets the digital pin as output
  digitalWrite(SegmentPin[i], HIGH);      // sets the digital pin as output
 }
 for (i=0;i<NDIGITS;i++) {
  pinMode(DigitPin[i], OUTPUT);      // sets the digital pin as output
  digitalWrite(DigitPin[i], HIGH);      // sets the digital pin as output
 }
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()                     // run over and over again
{ int d,i;
  char *string="Dorkbot";
  for (d=0;d<7;d++){
   for (i=0;i<14;i++) {
       digitalWrite(SegmentPin[i],charmap[ascii2charmap(string[d])][i]);
   }
   digitalWrite(DigitPin[d],HIGH);
   delay(5);
   digitalWrite(DigitPin[d],LOW);
 }

  //delay(100);                  // waits for a second

}

E Whah La.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.