Recent Posts

Pages: [1] 2 3 ... 10
1
Since I'm having struggles with uploading a picture, the wiring is as follows (numbers correlate to digital slot):

12 -> Button. Catty-corner on button ->resistor-> 11. 8 -> LED -> resistor -> GND.
2
memcpy_P is your friend :)
Thanks for the memory jog.  I neglected to include this: AVR program space functions.
3
General Electronics / RGB Lights always dimly ON
Last post by destiny2008 - Today at 03:17 am
hi,
I am doing this circuit on attiny85 even tried it on arduino but the rgb strip leaks and stays on any ideas?
4

Quote
It seems that it boils down to... "the blue smoke stays inside the components but the brightness will drop".
Based on your statement you have a good handle on the concept.  As for the Ohm's law thing, if you continue down this path (controlling stuff etc) you will eventually learn it.   I will admit though it is much easier if someone could explain it rather than studying some web site.

5
How do you intend to deal with a and/or b not being two digit numbers? Suppose a is 3 and b is -14. What do you want the string to look like? Suppose a is 12 and b is 124. What do you want the string to look like?


Why do you have such a bizarre requirement, anyway?
As I said it comes from a counter.It can never have negative values.
But it can be 124. Or maybe 1340294...
So it has to be a value with some more places like xxxxxxxxx10.
I am trying to send a message with the count + a pre assigned number.
There are many units like this and they are assigned a number.
6
Hey guys, I'm trying to drive a 5v voltage meter via a rotary encoder through an arduino Uno R3.

I have a pretty simple sketch, and the rotary encoder works great, counting between 0 and 100 in increments of 1, with little bounce unless I spin it SUPER fast.  Any normal movements work as expected.

But when I enable the two output lines to the Volt Meter, it starts bouncing like crazy.  It becomes difficult to even advance in one direction or the other.

I'm pretty new to this, so I don't care if my code is clean or perfect, but I can't figure out why it starts bouncing by running an analog write. . .

Lil help?

Code: [Select]


#define meterPin 5  //PWM on digital pin 5

// Rotary Encoder pins
#define encoder0PinA  2
#define encoder0PinB  4
#define encoder0PinC  3

volatile int encoder0Pos = 50;
int meterOutput = 127;

void setup() {
 
  pinMode(encoder0PinA, INPUT);           //Initiate pin as Input
  pinMode(encoder0PinB, INPUT);           //Initiate pin as Input
  pinMode(encoder0PinC, INPUT);           //Initiate pin as Input
 
  digitalWrite(encoder0PinA, HIGH);       // turn on pull-up resistor
  digitalWrite(encoder0PinB, HIGH);       // turn on pull-up resistor
  digitalWrite(encoder0PinC, HIGH);       // turn on pull-up resistor

  attachInterrupt(digitalPinToInterrupt(encoder0PinA), doEncoder, RISING);  // encoder pin on interrupt 0 - pin 2
  attachInterrupt(digitalPinToInterrupt(encoder0PinC), resetEncoder, FALLING);  // encoder pin on interrupt 1 - pin 3

  Serial.begin (9600);                    // Start the serial monitor
  Serial.println("start");                // setup is done
}

void loop(){
}

void resetEncoder() {
    encoder0Pos = 50;
    Serial.println("Reset:");
    Serial.println(encoder0Pos);
}

void doEncoder() {
  if (digitalRead(encoder0PinA) == HIGH && digitalRead(encoder0PinB) == LOW) {    //If encoder is turning clockwise . . .
    if (encoder0Pos < 100){         //Keep it in range
    encoder0Pos++;                  //Add 1
    }
  } else {
    if (encoder0Pos > 0){           //Keep it in range
    encoder0Pos--;                  //Subtract 1
    }
  }
  Serial.println (encoder0Pos);
 
//  meterOutput = map(encoder0Pos, 0, 100, 0, 255);           // Remap encoder number to 0-255 for Volt Meter
//  analogWrite(meterPin, meterOutput);                       //Output voltage to the meter
}
7
memcpy_P is your friend :)
8
Project Guidance / Re: Can I run a command only o...
Last post by dougp - Today at 03:08 am
Following on to @PaulRB's recommendation, your goal here is not to sense that the switch IS on but that it just CHANGED to on.  This is what the state change detection example shows.

In the IDE: File/examples/digital/StateChangeDetection.
9
Sensors / Re: Multiple DS18B20
Last post by Wawa - Today at 03:02 am
Code: [Select]
#include <DallasTemperature.h>
#include <OneWire.h>

OneWire oneWire(6); // pin D6
DallasTemperature sensors(&oneWire);
float temp1, temp2;

void setup() {
  Serial.begin(115200);
  Serial.println("DS18B20 thermometer");
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures();
  temp1 = sensors.getTempCByIndex(0);
  temp2 = sensors.getTempCByIndex(1);
 
  Serial.print("Temp1 is ");
  Serial.print(temp1, 1); // one decimal place
//Serial.print(temp1, 4); // four decimal places
  Serial.println(" C");
  Serial.print("Temp2 is ");
  Serial.print(temp2, 1);
  Serial.println(" C\n");
}
10
Editor / Re: Updates on the Arduino Web...
Last post by ballscrewbob - Today at 03:00 am
@deep_jeet

It will usually highlight the offending line in RED and will not release the red colour until you perform an action on that line.

The lower console should also indicate somthing about the error but tends to work better with VERBOSE turned on in preferences.

Pages: [1] 2 3 ... 10