Show Posts
Pages: [1] 2 3 ... 583
1  Using Arduino / Sensors / Re: 2 thermistors on: August 01, 2014, 09:59:48 pm
#include <Thermistor.h>

Thermistor temp1(A0);
Thermistor temp2(A1);

void setup() {

void loop() {
  Serial.print("Temperatura no Sensor eh: ");
  Serial.print( temp1.getTemp());

  Serial.print("Temperature of sensor 2: ");
  Serial.print( temp2.getTemp());

2  Using Arduino / Programming Questions / Re: Help on changing LED lighting by servo meter positioning on: August 01, 2014, 09:53:45 pm
Did you mean to say:

  if(potVal <341){
    digitalWrite(redLEDPin, LOW);
    digitalWrite(yellowLEDPin, LOW);
    digitalWrite(greenLEDPin, HIGH);
  }else if(potVal >340 && potVal <640){
    digitalWrite(redLEDPin, LOW);
    digitalWrite(yellowLEDPin, HIGH);
    digitalWrite(greenLEDPin, LOW);
  }else if(potVal >640){
    digitalWrite(redLEDPin, HIGH);
    digitalWrite(yellowLEDPin, LOW);
    digitalWrite(greenLEDPin, LOW);

You should probably also get rid of this code which overrides the code above:
  analogWrite(redLEDPin, redpotVal);
  analogWrite(yellowLEDPin, yellowpotVal);
  analogWrite(greenLEDPin, greenpotVal);
3  Using Arduino / Programming Questions / Re: OTP Generator on: August 01, 2014, 07:07:30 am
SHA1 is a hashing algorithm, not a pseudo random number generator.  It doesn't use a "seed".

If your "shared secret key" is only 8 bits it will be trivial to brute-force.  Your shared key should be more like 8 or 16 bytes (64 or 128 bits).
4  Using Arduino / Project Guidance / Re: RFID HELP NEEDED on: July 31, 2014, 08:55:28 pm
Looks to me like the NFC/RFID sensors in the "Smart Washer" are behind plastic parts:

I would be surprised if RFID worked through sheet-metal.
5  Using Arduino / Microcontrollers / Re: Atmega 328P as isp programmer on: July 31, 2014, 08:50:58 pm
Yes.  Load the ArduinoISP sketch onto it.  If your USB-to-Serial implements Auto-reset (DTR) you should disable that.

Probably cheaper to order a USBasp from eBay for <$4.
6  Topics / Device Hacking / Re: arduino is open hardware? on: July 31, 2014, 08:45:47 pm
Did you want the ATmega328P datasheet?

Or did you mean something else?
7  Using Arduino / Programming Questions / Re: OTP Generator on: July 31, 2014, 01:50:25 pm
The 'seed' (value being hashed with SHA1) is calculated from the shared key and the 8-byte counter.  See the specification:
8  Using Arduino / Motors, Mechanics, and Power / Re: Why use a PWM expander for servos? on: July 31, 2014, 09:15:59 am
The Servo library relies on interrupts.  If you use something like SoftwareSerial that disables interrupts for significant amounts of time you will get jitter in your servos.  The hardware solution would not be subject to that interrupt latency jitter.
9  Using Arduino / LEDs and Multiplexing / Re: Question regarding PCF8574P usage on: July 31, 2014, 09:09:31 am
Only one extra question, between the 74HC595 and the PCF8574P, the PCF8574P is the only one I could user for inputs?

Yes.  You would use a 74HC165 for inputs.  If you use the SPI interface you can clock data out to a 74HC595 and in from a 74HC165 at the same time.
10  Using Arduino / Programming Questions / Re: Using Leonardo and getting absolute x,y Mouse values on: July 31, 2014, 09:01:25 am
Did you try this permutation:

//  Specify pixel positions for a 640x480 screen
const int ScreenWidth = 640;
const int ScreenHeight = 480;
const int ScreenXLeft = 0;
const int ScreenXRight = ScreenWidth-1;
const int ScreenYBottom = 0;
const int ScreenYTop = ScreenHeight-1;

void moveTo(int absoluteX, int absoluteY) {
      // Do the math in long integers to avoid integer overflow problems

      // Constrain the position to keep it within the screen area
     long int X = constrain(absoluteX, ScreenXLeft, ScreenXRight);
     long int Y = constrain(absoluteY, ScreenYBottom, ScreenYTop);

     // Map the coordinates to the range of all integers
    X = map(X, (long) ScreenXLeft, (long) ScreenXRight, -32768L, 32767L);
    Y = map(Y, (long) ScreenYTop, (long) ScreenYBottom, -32768L, 32767L);

   // Move to that position
    Mouse.moveAbs((int)X, (int)Y, 0);
11  Using Arduino / Sensors / Re: HC-SR04 Ultrasonic Sensor detection problem. on: July 31, 2014, 06:39:48 am
Whenever the distance is greater than 20 cm reset a timer:
static unsigned long startTime = 0;
if (distance > 20)
    startTime = millis();
Whenever the distance is less than 20, check the timer:
else {
    if (millis() - startTime > 5000) {
If the timer has reached the limit (i put in 5 seconds) you trigger the door:
        digitalWrite(doorSolenoidPin, HIGH);
        digitalWrite(doorSolenoidPin, LOW);
And then go into a wait loop until the Reset button is pressed:
        while (1) delay(1000);
12  Using Arduino / Installation & Troubleshooting / Re: Opening Serial Monitor Restarts Sketch On Nano. IS THIS NORMAL?? on: July 30, 2014, 08:54:16 pm
That is normal behavior.  It is the auto-reset feature that allows you to upload sketches without pressing the reset button.
13  Using Arduino / Sensors / Re: Measuring angle using gyroscope on: July 30, 2014, 08:52:25 pm
dt = (now  - lastTime ) /1000

That line is missing the closing semicolon so it won't compile. 

Dividing a small integer (now - lastTime) by 1000 is likely to result in the value 0.  You should, therefore, not do the division here.
14  Using Arduino / Project Guidance / Re: Upload Binary from arduino? on: July 30, 2014, 08:46:58 pm
The program 'avrdude' which the Arduino IDE uses to upload your sketch can also download from the ATmega memory.  I think the Arduino bootloader supports reading (so the upload can be verified) so you should be able to run avrdude in a command window and get it to download the memory contents.  Hopefully it can download it in .hex format for later upload.
15  Using Arduino / Sensors / Re: Measuring angle using gyroscope on: July 30, 2014, 08:20:42 pm
I don't see the 'dt' calculation in either test.ino or gyro.ino.  The calculations you show above are unlikely to work.

now = millis();
dt = (now-lastTime)/1000;  // This will produce dt=0 if 'now' and 'lastTime' are both unsigned long as they should be.
dt = now;  // Shouldn't this be "lastTime = now;"?
Pages: [1] 2 3 ... 583