Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Finding an IC on: April 24, 2011, 06:18:30 am
Hi

I'm almost finished designing my simple calculator but, I'm having a hard time finding an IC which can drive a 7 segment display and display hexadecimal letters besides the regular numbers.
I have already found one, the MC14495P http://www.datasheetcatalog.org/datasheet/motorola/MC14495P1.pdf, but it seems to be obsolete.

Can anyone help me find a similar IC?
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Array question on: August 05, 2010, 09:02:00 am
The array is variable in length but the strings are predefined  
I've just found out, that in the bottom of this [http://www.arduino.cc/en/Reference/String] Arduino website, it explains how to make an array of strings. I have no idea how I missed this :-?

I've wrote this code to see if it has the desired effect, which it does
Code:
char* strings[]={"String1","String2","String3","String4","String5","String6"};
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
  lcd.begin(16, 2);
}

void loop() {
  for (int i = 0; i < 6; i++){
    if (i ==0) {
      lcd.setCursor(0,0);
      lcd.print("                ");
      lcd.setCursor(0,1);
      lcd.print(strings[i]);
    } else {
      lcd.setCursor(0,0);
      lcd.print(strings[i-1]);
      lcd.setCursor(0,1);
      lcd.print(strings[i]);
    }
    delay(500);
  }

I'm sorry wasting all of your time.

On a final note could you tell me the difference between:
Code:
char* strings[]
and
Code:
char *strings[X]
? What difference makes it where the star-thingy is?
3  Forum 2005-2010 (read only) / Troubleshooting / Re: Array question on: August 05, 2010, 08:40:57 am
I'm trying to make a menu system for an LCD display.
The algorithm has to generate an array of strings which each corresponds to  a menu element. (Does this make any sense?)

The button was just as an example of a trigger.

The strings, which will be in the list, are predefined and would probably be stored in the flash memory.
4  Forum 2005-2010 (read only) / Troubleshooting / Re: Array question on: August 05, 2010, 05:35:28 am
So is their any other way of storing strings in an array after the Arduino has been turn on?
5  Forum 2005-2010 (read only) / Troubleshooting / Re: Array question on: August 04, 2010, 07:00:13 pm
I don't know how PROGMEM works, but can it write to the flash memory or is it read only?

My list is created when a certain button is pressed.
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Array question on: August 04, 2010, 04:21:41 pm
Not more than 14 strings
7  Forum 2005-2010 (read only) / Troubleshooting / Array question on: August 04, 2010, 04:12:08 pm
Hey

I was wondering if it's possible make an array containing strings?
or is their any other way of accessing multiple strings easily?

Median
8  Forum 2005-2010 (read only) / Scandinavia / XBee on: August 04, 2010, 07:07:36 pm
Hey

Jeg er relativt ny til Arduino og har ikke rigtig udforsket de forskellige område som f.eks avancerede sensorer og internet forbindelse.

Jeg ville bare høre om hvad folks erfaringer er med XBee?
Er de de nemme at anvende?
Er forbindelsen af god kvalitet?
Kan man overføre store mængder af data?
Er koden til Arduino'en svær?
Er vigtigst af alt, er de gode til at lave Mesh-networks? Eller skal man selv kode det?

Median
9  Forum 2005-2010 (read only) / Scandinavia / Re: Hjælp til valg af transistorer: 5x17 Led matrix on: August 04, 2010, 04:53:21 pm
Her er en simulator til elektroniske kredsløb: http://falstad.com/circuit/

Så kan du selv prøve dig frem;) (jeg er selv heller ikke helt inde i hvad de forskellige transistorer gør smiley)

Inde i programmet kan du gå under Circuits->Transistors og så ligger der mange eksempler der.
10  Forum 2005-2010 (read only) / Scandinavia / Re: Kasse, næsten perfekt til Arduino til 8 kr on: August 04, 2010, 04:19:14 pm
Tak for tippet!
11  Forum 2005-2010 (read only) / Exhibition / Re: 16x4 "pixel" display on: January 07, 2011, 12:55:17 pm
Quote
A picture?

How about a video in crappy quality?
12  Forum 2005-2010 (read only) / Exhibition / Re: 16x4 "pixel" display on: January 06, 2011, 01:49:36 pm
Added three more effects:
Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);

float w=0;
float u=0;
float t=0;
int xWidth = 16;
int yWidth = 4;

//y first, x second
byte dis[4][16] = {
  {B1,B0,B0,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0    },
  {B0,B0,B1,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0    },
  {B0,B0,B1,B0,B0,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0    },
  {B1,B0,B0,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0    },
};

static byte top[8] = {B11111,B11111,B11111,B11111,B00000,B00000,B00000,B00000};
static byte bot[8] = {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111};
static byte ful[8] = {B11111,B11111,B11111,B11111,B11111,B11111,B11111,B11111};

void setup() {
  lcd.createChar(0,top);
  lcd.createChar(1,bot);
  lcd.createChar(2,ful);
  lcd.begin(xWidth,yWidth/2);
  updateDisplay();
}

void loop() {
  while(w<500) {
    fillDisplay(0);
    for(int x=0;x<xWidth;x++) {
      paint(x,2+2*cos(radians(w*(x+1))),1);
    }
    updateDisplay();
    w+=0.5;
  }
  w=0;
  while(w<50) {
    fillDisplay(0);
    for (int x=0;x<xWidth;x++) {
      for (int y=0;y<yWidth;y++) {
        u=255*cos(x)+255*sin(radians(w*y));//would look better on bigger display;Tested in Processing
        u=(u>16)?1:0;
        paint(x,y,u);
      }
    }
    updateDisplay();
    w+=0.1;
  }
  w=0;u=0;t=0;
  while(t<520) {
    w=40*cos(millis()/480)+70*cos(millis());
    u+=(w-u)/50;
    fillDisplay(0);
    for (int x=0;x<xWidth;x++) {
      paint(x,2+2*cos(radians(((1+x)*u)+millis()/20)),1);
    }
    t+=0.4;
    updateDisplay();
  }
  w=0;u=0;
  while(w<750) {
    fillDisplay(0);
    for (int x=0;x<xWidth;x++) {
      for (int y=0;y<yWidth;y++) {
        u=x^y;
        u=(u<8+8*cos(radians(w)))?1:0;
        paint(x,y,u);
      }
    }
    updateDisplay();
    w+=1.4;
  }
  w=0;u=0;
}

void fillDisplay(int c) {//0=white, 1=black, 2=invert
  for (int x=0;x<=xWidth;x++) {
    for (int y=0;y<=yWidth;y++) {
      if(c==2){
        dis[y][x]^=B1;
      }
      else{
        dis[y][x]=(c==1)?B1:B0;
      }
    }
  }
}

void paint(int x,int y,int c) {
  x=round(x);
  y=round(y);
  if (x<17&&x>-1&&y>-1&&y<5) {
    if(c==2){
      dis[y][x]^=B1;
    }
    else{
      dis[y][x]=(c==0)?B0:B1;
    }
  }
}
void updateDisplay() {
  lcd.setCursor(0,0);
  int r;
  for (int i=0;i<=xWidth;i++) {
    r=0;
    r+=(dis[0][i]==B1)?1:0;
    r+=(dis[1][i]==B1)?2:0;
    lcd.write((r==0)?254:r-1);
  }
  lcd.setCursor(0,1);
  for (int i=0;i<=xWidth;i++) {
    r=0;
    r+=(dis[2][i]==B1)?1:0;
    r+=(dis[3][i]==B1)?2:0;
    lcd.write((r==0)?254:r-1);
  }
}
13  Forum 2005-2010 (read only) / Exhibition / 16x4 "pixel" display on: January 02, 2011, 02:24:46 pm
I've wanted to make a little cool effect on my 16x2 character display for a little music project I've been planning. So I made this little sketch and I wanted to share.

I tried to make the code comprehensible but please tell me if not.

Each character is two "pixels".

Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);

float w=0;
int xWidth = 16;
int yWidth = 4;

//y first, x second
byte dis[4][16] = {
  {B1,B0,B0,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0  },
  {B0,B0,B1,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0  },
  {B0,B0,B1,B0,B0,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0  },
  {B1,B0,B0,B0,B1,B0,B1,B0,B0,B0,B0,B0,B0,B0,B0,B0  },
};

static byte top[8] = {B11111,B11111,B11111,B11111,B00000,B00000,B00000,B00000};
static byte bot[8] = {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111};
static byte ful[8] = {B11111,B11111,B11111,B11111,B11111,B11111,B11111,B11111};

void setup() {
  lcd.createChar(0,top);
  lcd.createChar(1,bot);
  lcd.createChar(2,ful);
  lcd.begin(xWidth,yWidth/2);
  updateDisplay();
}

void loop() {
  fillDisplay(0);
  for(int x=0;x<xWidth;x++) {
    paint(x,2+2*cos(radians(w*(x+1))),1);
  }
  updateDisplay();
  w+=1;
}

void fillDisplay(int c) {//0=white, 1=black, 2=invert
  for (int x=0;x<=xWidth;x++) {
    for (int y=0;y<=yWidth;y++) {
      if(c==2){dis[y][x]^=B1;}else{dis[y][x]=(c==1)?B1:B0;}
    }
  }
}

void paint(int x,int y,int c) {
  x=round(x);
  y=round(y);
  if (x<17&&x>-1&&y>-1&&y<5) {
    if(c==2){dis[y][x]^=B1;}else{dis[y][x]=(c==0)?B0:B1;}
  }
}
void updateDisplay() {
  lcd.setCursor(0,0);
  int r;
  for (int i=0;i<=xWidth;i++) {
    r=0;
    r+=(dis[0][i]==B1)?1:0;
    r+=(dis[1][i]==B1)?2:0;
    lcd.write((r==0)?254:r-1);
  }
  lcd.setCursor(0,1);
  for (int i=0;i<=xWidth;i++) {
    r=0;
    r+=(dis[2][i]==B1)?1:0;
    r+=(dis[3][i]==B1)?2:0;
    lcd.write((r==0)?254:r-1);
  }
}

Haven't tested the code on other displays but should hopefully work.

Have a nice new year!
14  Forum 2005-2010 (read only) / Exhibition / Re: Arduino ir, my first project! on: January 06, 2011, 02:10:27 pm
Thanks for sharing!

You can shorten some of the code with ? : condition(http://processing.org/reference/conditional.html)
For instance:
Code:
    digitalWrite(led5,(results.value==16674959)?HIGH:LOW);
     digitalWrite(led5,(results.value==16650479)?LOW:HIGH);

Even though it's a bit more confusing
15  Forum 2005-2010 (read only) / Bar Sport / Re: Can't find this kind of part on: November 03, 2010, 05:48:42 am
Well, I was hoping not to go down the smd lane
Pages: [1] 2