Show Posts
Pages: 1 ... 62 63 [64] 65 66 ... 225
946  Using Arduino / Programming Questions / Re: rubber buttons on: July 08, 2013, 04:10:16 pm
Hum, how do i do that?

Google knows!
947  Using Arduino / Programming Questions / Re: rubber buttons on: July 08, 2013, 04:03:13 pm
Push buttons are input devices. Why would you configure the pins as output devices? Why not simply set the pins to input and enable to internal pullups?
948  Topics / Home Automation and Networked Objects / Re: Making Android Application Controller For Fan on: July 08, 2013, 03:47:01 pm
If you don't know how to program in Java, why are you doing a project that is going to have to be written in Java?

If you want to learn, take a look at some of the tutorials for Android development and get started learning.
949  Using Arduino / Programming Questions / Re: int tempo question on: July 07, 2013, 07:00:51 pm
Better two years late than never ... I guess.
950  Using Arduino / Programming Questions / Re: Arduino RF VirtualWire.h on: July 06, 2013, 10:01:17 pm
Can you make a example?

Code:
char a = Serial.read();
if (isDigit(a))
{
  b[i] = a - '0';
  i++;
}
else
{
  // send the data
}
951  Using Arduino / Programming Questions / Re: Arduino RF VirtualWire.h on: July 06, 2013, 08:38:47 pm
I understand.Is any way to solve this?

You're receiving it through Serial as a string, stuffing it into an int, and using the int to convert it to BCD. Why not just subtracted '0' from each character when you receive it and put it in the array. When you receive a non-number send the array.
952  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 12:03:25 pm
And the minimum pulse length is 2 microseconds ?

Don't know, what does the Datasheet say for whatever sensor you are using?
953  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:32:23 am
Ok to be clear, why should I divide by 20000 ?

Thanks

Because you receive a time in microseconds, and speed travels at 0.034029 centimeters per microsecond
954  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:28:35 am
How did I convert it ? I just get myself too confused with that smiley-sad

Convert what to what?
955  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 10:59:06 am
Speed of sound is ~34 cm per millisecond. pulseIn() returns a value in microseconds.
956  Using Arduino / Project Guidance / Re: How to send data from VB application and arduino thru RF-433 module on: July 06, 2013, 10:25:21 am
Quote
will this code work..??
Well, did it?

Not experimented yet, only wrote this code.... Will this work..??

You tell us, you got the hardware to test it.
957  Using Arduino / Programming Questions / Re: Operating stepper without delay on: July 06, 2013, 10:06:34 am
Your sensor calculations involve floating point arithmetic. The microcontrollers on the Arduino's don't have an FPU, so software emulation needs to be used. This means that it takes much longer to make floating point calculations than it does integer calculations. You're also printing to the Serial monitor unconditionally on every pass through loop; don't do that.
958  Using Arduino / Programming Questions / Re: Motor PWM using buttons on: July 05, 2013, 05:41:52 pm
Although I can not get the program to read the button states.

What evidence do you have to support this?

How is your switch wired up? What value pulldown resistor are you using?
959  Using Arduino / Programming Questions / Re: Operating stepper without delay on: July 05, 2013, 04:03:41 pm
The biggest mistake people when trying to get rid of delays is simply replacing delays with the BlinkWithoutDelay code. Putting said code inside a for loop in never going to work as desired. You need to separate the code that tells it to start from the code that tells it to continue:

Code:
static byte runFlag = 0;

if (someConditionToStart)
{
  runFlag = 1;
  // other code to setup the movement
}

if (runFlag)
{
  // BlinkWithoutDelay code goes here
  if (someConditionToStop)
  {
    runFlag = 0;
  }
}
960  Using Arduino / Programming Questions / Re: Sizeof arrays on: July 05, 2013, 01:52:42 pm
Again...

You have just used sizeof() on a pointer in a function. This time you have done sizeof(pins). It will return 2.

Do this:
Code:
void pinModeAutomatic(uint8_t pins[], uint8_t MODE, length){
  uint8_t i;
  for(i=0;i<length;i++){
    pinMode(pins[i],MODE);
  }
}
And accept it is the only way.



EDIT:
I suppose if you real *must*, you could do this:
Code:
#define pinModeAutomatic(p, m) pinModeAutomatic(p,m,sizeof(p))

uint8_t INPUTS[] = {2,4,6,8};
uint8_t OUTPUTS[] = {1,3,5,7,9,11,13};

void setup(){
  Serial.begin(9600);
  pinModeAutomatic(INPUTS,INPUT);
  pinModeAutomatic(OUTPUTS,OUTPUT);
}

void loop(){
//
}

void pinModeAutomatic(uint8_t pins[], uint8_t MODE, length){
  uint8_t i;
  for(i=0;i<length;i++){
    pinMode(pins[i],MODE);
  }
}
But it's just asking for trouble later on.

length needs a type
Pages: 1 ... 62 63 [64] 65 66 ... 225