Show Posts
|
|
Pages: 1 [2] 3 4 ... 90
|
|
16
|
Using Arduino / Displays / Re: Can this Sure GLCD use Arduino library
|
on: May 17, 2013, 07:32:35 am
|
Riva - I removed the display from the breadboard [too many wires to disconnect from the Uno  ] and the code uploaded but still nothing showing on the display. I also plugged an external 9V power supply into the barrel jack of the board. Sorry Pedro147 I can't really help with the display though I will look in some detail later (meant to be working). Did you have the 9V supply connected before when it failed to upload the sketch or have you since connected it? If it was running off 9V then maybe there is a screen/wiring problem or it's still drawing to much power.
|
|
|
|
|
20
|
Using Arduino / Motors, Mechanics, and Power / Re: Recognise encoder movment
|
on: May 17, 2013, 01:40:20 am
|
i added some code from example i found using a button and millis but my led just stays on when i move my encoder, could you give me an example of some code. i'm really new to this so i'm apologies for all my questions.
really appreciate the help This is un-tested and not elegant but you should be able to bend it to your needs const int encoder0PinA = 6; // Rotary Encoder A pin (12) const int encoder0PinB = 7; // Rotary Encoder B pin (13) const int LED = 13; // LED
unsigned long lastEncoder = 0;
void setup(){ pinMode (encoder0PinA,INPUT_PULLUP); // Enable pullup resistor pinMode (encoder0PinB,INPUT_PULLUP); // Enable pullup resistor pinMode (LED,OUTPUT); // LED readEncoder(); // Prime encoder routine }
void loop(){ int turned = readEncoder(); // Check if encoder moved since last call if (turned != 0){ // Anything other than 0 means it changed digitalWrite(LED,HIGH); // Turn LED on lastEncoder = millis(); // Note the time // React to encoder change } // Do other stuff here
if (millis() > (lastEncoder + 5000)){ digitalWrite(LED,LOW); } }
// Polled encoder, returns 1, 0 or -1 int readEncoder(){ static int encoder0PinALast = LOW; int eDir = 0; int n = digitalRead(encoder0PinA); if ((encoder0PinALast == LOW) && (n == HIGH)){ if (digitalRead(encoder0PinB) == LOW){ eDir = -1; } else { eDir = 1; } } encoder0PinALast = n; return eDir; }
|
|
|
|
|
21
|
Using Arduino / Motors, Mechanics, and Power / Re: Recognise encoder movment
|
on: May 16, 2013, 11:26:44 am
|
|
The basic principle of how to do this is every time the encode moves turn on the led and make a not of the current millis time. At some point in your loop() check if current millis time against the time the encoder last moved and turn the led off if it greater than 5000 (5 seconds).
|
|
|
|
|
22
|
Using Arduino / Project Guidance / Re: Greenhouse master controller in the middle of nowhere
|
on: May 16, 2013, 11:04:39 am
|
Dont know if I Should open a new thread, but I have a similiar question, in the an allmost similiar case. So I reckoned I could paste it here. And do not start a new threat. Hope this is the right manner.. As the thread is quite old now & your posting a new question you should maybe have started a new thread.
The following tasks the Arduino should do:
1) Put on a relais for 10 hours on a daily basis. relais = Relays?
2) Put on an actuator for 10 mins dependent from two sensor and two boundairy values. (Thus totally Independent from timing) What two sensors are you referring to and what are the boundary values?
My question: Can this be organized within one code (thus one process)? Is this stable and punctual? Do I need a clock? What would the scheme look like? I would suggest using a RTC module (Real Time Clock), something like a DS3231 (they are more accurate than DS1307) so if you loose power the clock keeps ticking. Really need to know what the sensors are to design any software/hardware.
|
|
|
|
|
23
|
Using Arduino / Motors, Mechanics, and Power / Re: Quadrature Encoder Signal Generator
|
on: May 16, 2013, 10:52:32 am
|
Below is the core of a possible way to generate the signal. Obviously you would need to adjust the code to suit your needs. I have also attached an LA image so you can see if it's correct. #include <avr/interrupt.h>
#define T2Speed 50
const int LED = 13; const int channelA = 2; const int channelB = 3;
volatile byte tmrCount = 0; //Timer2 overflow interrupt vector handler ISR(TIMER2_OVF_vect) { TCNT2 = T2Speed; //reset timer digitalWrite(LED,HIGH); switch (tmrCount) { case 0: digitalWrite(channelA,HIGH); break; case 1: digitalWrite(channelB,HIGH); break; case 2: digitalWrite(channelA,LOW); break; case 3: digitalWrite(channelB,LOW); } tmrCount++; if (tmrCount >= 4) { tmrCount = 0; } digitalWrite(LED,LOW); TIFR2 = 0x00; };
void setup() { Serial.begin(115200); pinMode(LED,OUTPUT); // UNO LED, just for show pinMode(channelA,OUTPUT); pinMode(channelB,OUTPUT);
TCCR2A = 0; //Timer2 Settings: WGM mode 0 TCCR2B = _BV(CS22); //Timer2 Settings: Timer Prescaler /64 TIMSK2 = _BV(TOIE2); //Timer2 Overflow Interrupt Enable TCNT2 = T2Speed; //reset timer }
void loop() { }
|
|
|
|
|
24
|
Using Arduino / Motors, Mechanics, and Power / Re: Quadrature Encoder Signal Generator
|
on: May 16, 2013, 07:04:32 am
|
What encoder are you trying to simulate?
I am trying to generate a RS422 pulse. Sorry, I must be having a blonde moment here in understanding but RS422 is just a specification for electrical signals of communications equipment, I cannot see how this relates to a 'Quadrature Encoder' unless your using RS422 to transmit the signals some distance to the decoder? Assuming the encoder is 2 channels then you could do it with a timer interrupt set to 4x the required frequency so you can toggle the A & B signals 25% out of phase. You could then connect a RS422 line driver chip and output theses signals at the levels required (assuming your using the arduino to simulate the encoder). Simple software could control on/off of the encoder signals, direction and alter the frequency by adjusting the timer timebase.
|
|
|
|
|
25
|
Using Arduino / Motors, Mechanics, and Power / Re: Quadrature Encoder Signal Generator
|
on: May 16, 2013, 06:30:29 am
|
|
What encoder are you trying to simulate? PWM will just keep running at a fixed frequency without intervention once started, is this what you need or do you want it to start/stop at your command or maybe run at different frequencies. We basically need more information on what your trying to do.
|
|
|
|
|
28
|
Using Arduino / Microcontrollers / Re: Using ArduinoISP to flash firmware on HC-05/06 JY-MCU bluetooth module??
|
on: May 16, 2013, 04:56:29 am
|
|
I would think the first thing you need to do is either reverse engineer the sequence of commands sent from the PC software or capture them using a logic analyser so you know what needs sending to the BT module. I had considered doing this myself and had registered & downloaded the software but deemed it to much hassle for just re-programming a couple of HC-06 to HC-05 firmware. Good luck though.
|
|
|
|
|