Pages: 1 ... 8 9 [10]
 91 
 on: Today at 06:19:56 pm 
Started by JayCol - Last post by steinie44
Quote
I notice on your picture only two connections to the pot.
You should have three.
He has three. The center is a resistor to A0. That is correct.

 92 
 on: Today at 06:14:44 pm 
Started by JayCol - Last post by raschemmel
I think the previous observation about the diode polarity is the reason the motor is still turning. It would help if you could just draw the schematic on a piece of printer paper and take a photo of it and post it. 

The flyback diode should ALWAYS go directly ACROSS the INDUCTIVE component, be it a relay , solenoid or motor, with the CATHODE connected to the POSITIVE terminal of the device and the ANODE connected to the NEGATIVE terminal of the inductive device. It looks like your diode is either backwards or it is across the power supply. (can't tell for sure)

 93 
 on: Today at 06:12:14 pm 
Started by ewholz - Last post by AussieSusan
Not an answer to the "E"s question, but if you must use the "printf" family of routines (and personally I find it very hard to justify the overhead of a run-time interpreter when the format string is almost always static, plus the storage overhead of every function the family might need even if the format is never actually used - all in a limited memory and generally slow processor!!! - end of soapbox dissertation) the why not use something like:
sprintf( buffer, "  %02ld:%02ld:%02ld  ", hours, mins, secs)
(Each of those format strings is "percent zero two lowercase-ell lowercase-d.)
That format specification tells the printf formatter to use a 2 character field with that is left-padded with zeros and does away with all of the "if - else" options. Also it can add in the spaces as necessary.
(Return to the soapbox - I would use something like the 'ltoa' function even if it does mean either testing for 'less than 10' as you have done or adding 100 and skipping the first character)
Susan

 94 
 on: Today at 06:09:53 pm 
Started by Helda - Last post by SurferTim
You only need to start Serial1 once, just like Serial.
Code:
void setup() {
    Serial.begin(19200);
    Serial1.begin(19200);
 
   pinMode(6, OUTPUT);
    internet.connectToInternet();
    digitalWrite(6, HIGH); // Power on GSM shield
    delay(10000); // wait for connect to gsm network
    gsm.sendSms("Any text")
}
You are not reading the response from the modem, so it will be almost impossible to troubleshoot.
Code:
    delay(1000); //Wait for a second while the modem sends an "OK"
What if it isn't sending an "OK"?

 95 
 on: Today at 06:09:08 pm 
Started by mohamed-mamdouh - Last post by mohamed-mamdouh
Unfortunately i can't know how to put all the characters into one string
i used
Code:
String distance=Serial.read();

but there's an error
Quote
no known conversion for argument 1 from 'int' to 'const

 96 
 on: Today at 06:06:53 pm 
Started by dschmitty90 - Last post by cattledog
The software to read the encoder will depend upon the type of encoder you use. The following code is for a polled encoder with a detent at every quadrature index position around the dial. I was testing on an optical encoder so there is no debounce. The encoder has a built in switch which I use for reset in this sketch.

Code:
//Based on code from: http://bildr.org/2012/08/rotary-encoder-arduino/

//Added start up position check to make index +1/-1 from first move
//Polled rather than interrupts

int encoderPinA = 10;
int encoderPinB = 11;
int buttonPin = 5;

int lastEncoded = 0;
int encoderValue = 0;

int lastencoderValue = 0;

void setup() {
  Serial.begin (9600);

  pinMode(encoderPinA, INPUT_PULLUP);
  pinMode(encoderPinB, INPUT_PULLUP);
  pinMode(buttonPin, INPUT_PULLUP);

  //get starting position
  int lastMSB = digitalRead(encoderPinA);
  int lastLSB = digitalRead(encoderPinB);

  Serial.print("Starting Position AB  " );
  Serial.print(lastMSB);
  Serial.println(lastLSB);

  //let start be lastEncoded so will index on first click
  lastEncoded = (lastMSB << 1) |lastLSB;

}

void loop(){

  int MSB = digitalRead(encoderPinA); //MSB = most significant bit
  int LSB = digitalRead(encoderPinB); //LSB = least significant bit

  int encoded = (MSB << 1) |LSB; //converting the 2 pin value to single number
  int sum  = (lastEncoded << 2) | encoded; //adding it to the previous encoded value

  if(sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011) encoderValue ++;
  if(sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000) encoderValue --;

  lastEncoded = encoded; //store this value for next time


  if(encoderValue != lastencoderValue){
    Serial.print("Index:  ");
    Serial.println(encoderValue);

    Serial.print("Binary Sum:  ");
    for (int i = 0; i < 4; i++)//routine for printing full 4 bits, leading zeros
    {
      if (sum < pow(2, i))
        Serial.print(B0);
    }

    Serial.println(sum,BIN); //prints out last and current binary pattern
    lastencoderValue=encoderValue;
  }

  //reset index
  if(digitalRead(buttonPin)==LOW){
    encoderValue=0;
  }

}

 97 
 on: Today at 06:04:20 pm 
Started by ewholz - Last post by Peter_n
Your timeBuff is ony 8 characters, but when you use sprintf, it adds an extra '\0', or string-terminator, or zero-terminator.
So you use 9 characters. If you make it timeBuff[10] is might work.

 98 
 on: Today at 06:04:08 pm 
Started by archy587 - Last post by archy587
Hello,

Im trying to apply a DC voltage to a piezoelectric device, with the intent to achieve controlled motion on the nano-scale.

I have a 20v power supply, the piezo disk from a regular buzzer, and an arduino uno.

lets say applying 1v DC to the piezo will cause a 10 nanometer deflection in the crystal. Then the full 20v would allow for a working range of 200nm. Im ok with this, but I'm trying to come up with a way to accurately control voltage steps so that I can have at least 1024 discrete positions. That is, increment the applied voltage by about 20mV, from 0 to 20. 

I've been thinking about it but I can't come up with any output method that would give me 1024 possible values.

the best I can come up with is to use the PWM library to change the frequency of the output PWM signal. Doing this I think I could easily output 1024 different square wave signals, each with 50% duty cycle, but different frequencies. then use some kind of tone decoder to convert the output PWM signal to a predetermined DC voltage. But with 1024 possible frequencies, I think I would need some kind of FFT...

Am I making this too complicated? I'm just limited by the 256 possible outputs of analogWrite. is there a way to use more than one analog output pins to get to higher resolutions?

any suggestions would be appreciated!

thanks! 

 99 
 on: Today at 06:04:07 pm 
Started by ramoncrx - Last post by khreiz
Oye Nomada, muy bueno el skecht, yo uso el mismo shield y estaba buscando como mover los motores. Una cosa probé tu skecht y tras modificar los motores en las conexiones del shield solo me anda hacia un lado  ( solo va hacia delante) ¿ sabes porque puede ser ?

 100 
 on: Today at 05:57:49 pm 
Started by srj0408 - Last post by mauried
What do you mean by this
"switch over from solar PV module to Battery"
With any Solar Powered system, the battery should provide the power all the time.
All the Solar Panel should do is charge the battery.
There should never be any switchover from the battery to the Solar panel.
A circuit diagram would help.

Pages: 1 ... 8 9 [10]