Show Posts
Pages: 1 ... 18 19 [20] 21 22 ... 242
286  Using Arduino / Project Guidance / Re: how to make a Boebot controlled by arduino uno get out of a maze? on: July 10, 2014, 01:22:06 pm
right.attach(smiley-cool;   //pin

I don't think I got the memo that smiley faces could be used as pins. Could you put your code in code tags. Its the # symbol above the smiley faces.[ code ] ... [/ code]

I also see a lot of delays, no no no. Not good for your code.

287  Using Arduino / Project Guidance / Re: Minimum Safe SRAM Memory Level (for Uno)? on: July 10, 2014, 01:18:14 pm
Post your code. Did you remember to use PROGMEM or Flash memory for all your strings?
288  Using Arduino / Programming Questions / Re: Using RGB LED's and a potentiometer to control colour based on Kelvin scale on: July 10, 2014, 01:10:59 pm
Well one way to map RGB values to a linear range (1000-6000) would be to make the values into type word 0xRRGGBB or in 565 format  and scale it based on the range.

You could probably use the map() function for this like I did here.
Code:
void setup()
{
 Serial.begin(115200);
}

void loop()
{
  Serial.println(map(analogRead(A0),0,1023,0x0000,0xFFFF),HEX); // map 0-1023 to 565 color format
}

This code here does the reverse of what you want, but you could reverse engineer it.
Code:
void setup(){
Serial.begin(115200);
delay(10);
Serial.print(ConvertRGB(255,255,13), HEX);
}

void loop() {
 
}

uint16_t ConvertRGB( byte R, byte G, byte B)
{
  return ( ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | (B >> 3) );
}
289  Using Arduino / Programming Questions / Re: Input and Output Tables on: July 10, 2014, 09:15:44 am
Its just in case you get a value that is not one of the case statements, this way instead of getting weird results, you can put it to something that wont cause any damage.

@CrossRoads
I wouldn't even want to write out all that.
290  Using Arduino / Programming Questions / Re: Input and Output Tables on: July 10, 2014, 09:10:47 am
Edit: you posted yours while I was typing mine.

Quote
but the problem i see with doing division to access the array is that it lacks tuning.
You make the values yourself, so you can tune it to whatever you want.

As for the case statement example:

Code:
switch(rpm_val)
{
  case 800 . . . 899: // i cant remember if the ellipsis need to be spaced or not. it might just be "..."
     vgt = 20;
     break;

  case 900 . . . 999:
     vgt = 35;
     break;
 
  case 1000 . . . 1099:
     vgt = 50;
     break;
  .
  . // rest of them
  .
  case 4400 . . . 4499:
     vgt = 250;
     break;

  default: // optional but good to have
    vgt = 10;
}
291  Using Arduino / Programming Questions / Re: Input and Output Tables on: July 10, 2014, 09:00:06 am
You might be able to find a common factor and just divide the RPM by it, to give you the VGT.

Or you can make an array of all the VGT values you want, and using division, you can access those values.

int VGT[37] = { 0 , 20 , 40 . . . 200};// set all values

output = VGT[rpm/100]; // 2000 / 100 = 20-> index 20 in array, 2100 / 100 = index 21 in array.

Edit:

Quote
rpm_val = analogRead(rpm);

if( rpm>= 2000 && rpm < 2100)
Why are you comparing the rpm pin to your range and not rpm_val, which of course will only have a range of 0 - 1023?
292  Using Arduino / Programming Questions / Re: Input and Output Tables on: July 10, 2014, 08:22:22 am
Case statements are another way. Or you can try to map the input values to produce the correct output values.
293  Using Arduino / Project Guidance / Re: Quizmaster on: July 09, 2014, 09:10:43 am
If your concerned with timing, then you can use interrupts, but for something like this, interrupts are overkill. Plus anything other than a Mega, will only have 2 interrupts.

In this case since you are going to be checking which person was first, stay away from the delay() function, it will be what kills your code. However if you do need some kind of delay, then you can use the millis() function to keep track of the passing time and do something when you need it to. Take a look at your example sketch Blink Without Delay, it will help you a lot.
294  Using Arduino / Displays / Re: ST7565R LCD TO AMPLIFIER CIRCUIT. PLEASE HELP!!! on: July 09, 2014, 09:01:33 am
You don't have to shout. Also this does not appear to be a LCD question, but more of a guidance question.

Quote
I have little/no experience or skill in programming and understanding stuff like this.
This may be a problem, because we are not going to write the code for you. We can provide examples, but not a fully working code that does exactly what you want. Sorry.

Quote
i also got a maxim digital potentiometer
Which one, there are multiple.

The best thing you can do is get them to work individually, then we will help you put them together. One other thing that may be a problem, I'm not sure if there is a library for that particular LCD display. You could try the ST7565 Library made by Ladyada LINK
295  Using Arduino / Programming Questions / Re: Add text file to sketch arduino on: July 09, 2014, 08:29:27 am
You can put the text, not the .txt file into PROGMEM and read it back where you need it. It's actually quite easy to do.
296  Using Arduino / Displays / Re: LCD newbie HELP! on: July 08, 2014, 11:04:33 pm
If you think the wiring will be too much of a hassle, you could get a I2C backpack that way you only need to worry about 4 pins instead of 16. Different library of course but not by that much.
297  Using Arduino / Programming Questions / Re: Serial.print() issue or maybe something else on: July 08, 2014, 08:21:18 am
Well the only thing left to do now is to start commenting out larger portions. Then once the serial monitor is working again, then you can add things in little by little.

Added:
Were you able to get the Snapshot example sketch to work?
298  Using Arduino / Programming Questions / Re: Serial.print() issue or maybe something else on: July 08, 2014, 08:04:56 am
What is the baud rate your serial monitor is set to, 9600? You can find the number in the lower right corner when the serial monitor is open.
299  Using Arduino / Programming Questions / Re: Problem with creating a string from serial data on: July 07, 2014, 02:03:27 pm
-_- ha ha.
300  Using Arduino / Programming Questions / Re: Problem with creating a string from serial data on: July 07, 2014, 01:50:41 pm
*atoi()
Pages: 1 ... 18 19 [20] 21 22 ... 242