Show Posts
Pages: [1] 2
1  Using Arduino / Displays / Nokia 5110 and invalid conversion on: May 20, 2011, 01:27:30 pm
Using a Nokia 5110 LCD with the code supplied on the arduino site.
It works fine and dandy when you have predefined text to print on the screen.
However, I need it to behave dynamically, based on the values of a potentiometer.
Depending on the value of the pot, I need to pull a character from an array.
But when I do that, i get an invalid conversion from char to char*
Anybody have any tips on how to get this to jive?
2  Using Arduino / General Electronics / Re: Potentiometer is hot! on: March 21, 2011, 02:34:29 pm
I appreciate the help.
Something must have been crossed...
I cleaned up the sloppy wiring I had, and everything is "Kool and the Gang".
Thanks everyone for the help!

3  Using Arduino / General Electronics / Re: Potentiometer is hot! on: March 19, 2011, 09:02:08 am
Thanks for the reply.
Its wired as per usual, +to+, -to- and pin to pin.
its so weird, because now its not doing it...
I think the + and - lines might have crossed somehow.
would that do it?
4  Using Arduino / General Electronics / Potentiometer is hot! on: March 19, 2011, 08:07:00 am
I have a project that uses 4 pots, one of them gets flippin hot!
And I swear I saw some smoke come off of it.
It still works, but I was wondering what might be some causes of this?
And how I can prevent it?
Obviously, this is a bad thing....
5  Using Arduino / General Electronics / Re: Do I need to use a resistor for a small speaker? on: March 15, 2011, 01:37:52 pm
Thanks everyone!
I'm not looking to make anything real loud...
Just making a little chaos box that randomizes pitches and plays them based on a pot value.
There's some cool stuff here to think about in case I do want to make some REAL NOISE in the future!
I actually have an OP amp i grabbed for the heck of it one day, though I have no idea how to connect it.
More and more reading to do every day!
Again, thanks a ton.
I greatly appreciate the help.
 
6  Using Arduino / General Electronics / Do I need to use a resistor for a small speaker? on: March 14, 2011, 01:44:11 pm
I'm using a small speaker for a tone project.
Right now, I'm not using any resistors for it.
But, in the back of my head I have this tiny voice that is telling me I should be using a resistor.
Any help on what size I should use, or if I even need to use one?
The speaker is one I took out of an old speaker phone.
Thanks for any help!
7  Using Arduino / Programming Questions / Re: how to truncate? on: March 11, 2011, 11:10:22 am
awesome, thank you for the help.
I appreciate it!
8  Using Arduino / Programming Questions / Re: how to truncate? on: March 11, 2011, 11:03:58 am
I appreciate your replies.

ok, so if i declare as an int, means decimals will be dropped/ignored?
9  Using Arduino / Programming Questions / Re: how to truncate? on: March 11, 2011, 10:58:51 am
isnt a pot a 0-1023 value?

if, say I divide 1023 by 100 i would get 10.23

forgive me if im being dim!

i suppose i could write a bunch of if statements.

but i would like to know how to truncate if theres a way to do it.

there must be a way
10  Using Arduino / Programming Questions / how to truncate? on: March 11, 2011, 10:48:34 am
Is there a simple way to truncate?
I'm using a pot.
I want to divide its value by 100 and toss out the decimal.
so its value would be something between 0 and 10.
doesn't have to be precise.
I just need the value without decimals.
11  Using Arduino / Project Guidance / Re: How to create USB on a Do It Yourself Arduino on: March 09, 2011, 11:20:40 am
Thanks MarkT!
12  Using Arduino / Project Guidance / How to create USB on a Do It Yourself Arduino on: March 09, 2011, 08:21:48 am
I've been building do it yourself arduinos and all is well with what I've been putting together.
Making PCBs and assembling the minimal components.

However... I'd like to dive into more complex stuff and add USB.

Anyone know of a tutorial on how to do this?
I'd appreciate any push in the right direction.
Thank you!
13  Using Arduino / Displays / Re: 20x4 LCD is only working on 16 cols and 3 rows on: February 01, 2011, 01:26:39 pm
Ahh, I see...
Thanks for taking the time to answer, I appreciate it!
14  Using Arduino / Displays / Re: 20x4 LCD is only working on 16 cols and 3 rows on: February 01, 2011, 12:19:47 pm
Thanks for the reply Grumpy Mike.
I increased the delete lag variable, and it made the glyphs go across all the way.
Well, they are wrapping.
Funny thing is when I change this variable back to 5, it stops at 16th col.
At least I have an idea of where the problem might be.
Another question if I may be so bold...
I have the glyphs being randomly named (with a random number from 0-32).
When I go over 32, it ignores the random glyph and just prints a normal character.
Any idea why this is?
15  Using Arduino / Displays / 20x4 LCD is only working on 16 cols and 3 rows on: February 01, 2011, 11:25:22 am
I'm new to arduino, but I totally love this thang.
Anyways...
I'm writing a sketch that generates a random glyph -- it randomizes the binary used to build a custom character and creates an "alien-esque" letter or glyph.
The code then plots the glyph from left to right on a 20x4 LCD, with the glyph being erased 5 positions back.
I hooked up my LCD by using the ladyada tutorial for the 16x2 LCD.
It.... works... but stops in the 16th column, and doesn't generate on the 4th row.
I tried changing a bunch of things but nothing seems to work.

In the sketch is this code:
   LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
Initializing the LCD as the tutorial instructs.

I also changed the lcd.begin to:
   lcd.begin(20,4);
thinking this would be right for a 20x4 display.

My guess is that either of these two are messing me up somehow.
But I can't figure out how. And it's driving me nuts.
Anyone out there care to  have a look and see what I'm doing wrong?
Or if there are any things that could be done in a more practical way?
The entire code for the sketch is below.
Again, I'm new, so please be kind!!!!!!!

/*
=================================================
           ALIEN TEXT ~ Corey Kingsbury
=================================================
Creates a random "glyph" and then displays it on LCD screen.
Notes: connect button to PIN 2.
*/
#include <LiquidCrystal.h>

String message="Press button to";
String message2="generate glyphs.";
int button=2;
int buttonState=0;
int buttonSave=0;
int theDelay=200;
int glyph=0;
int act=0; // btn action
int col=0; // column 1 position
int row=0; // row position
int lag=5; // delay before deletion
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // setup the LCD

void setup(){
  lcd.begin(20,4);
  pinMode(button, INPUT);
//  Serial.begin(9600);
}

void loop(){
  buttonCheck();
  if(act==2){
    resetB();
    makeGlyph();
  }

  if (act==0){
    displayMessage();
  }
}

/*============================
   ------- FUNCTIONS -------
============================*/
//------- button operations
void buttonCheck(){
  buttonState=digitalRead(button);
  if(buttonState!=buttonSave){
    resetA();
    act++;
    if(act>3){
      resetA();
      act=0;
    }
  }
  buttonSave=buttonState;
}

//------- create the glyph
void makeGlyph(){
  //-- generate it
  byte bin[] = {B00000,B10000,B10111,B10110,B10101,B11000,B11011,B11010,B11001,B11100,B11110,B11111,B01111,B00111,B00011,B00001,B00010,B01110,B10011,B01101,B01010,B00101,B10010,B10100,B11101,B01001,B01011,B10001,B00110,B01000,B00100,B01100};
  byte setupGlyph[8] = {bin[random(31)],bin[random(31)],bin[random(31)],bin[random(31)],bin[random(31)],bin[random(31)],bin[random(31)],bin[random(31)],};
  glyph++;
  if(glyph>20){
    glyph=1;
  }
  lcd.createChar(glyph, setupGlyph);

  //-- position
  if(col>19){
    resetC();
  }
  row=random(3);
  lcd.setCursor(col, row);

  //-- write it
  lcd.write(glyph);
  delay(theDelay);
  col++;
}

//------- push the btn msg
void displayMessage(){
  lcd.setCursor(0,0);
  lcd.print(message);
  lcd.setCursor(0,1);
  lcd.print(message2);
}

//------- clear the LCD
void resetA(){
  lcd.clear();
  col=0;
  row=0;
}

void resetB(){
  lcd.setCursor(col-lag,0);
  lcd.print(" ");

  lcd.setCursor(col-lag,1);
  lcd.print(" ");

  lcd.setCursor(col-lag,2);
  lcd.print(" ");

  lcd.setCursor(col-lag,3);
  lcd.print(" ");
}

void resetC(){
  lcd.clear();
  col=0;
  row=0;
}
Pages: [1] 2