Show Posts
|
|
Pages: [1] 2 3 4
|
|
4
|
Using Arduino / Programming Questions / Re: Issue with digitalWrite
|
on: July 03, 2012, 01:39:52 pm
|
Sorry, I won't go further with this... I have used Atmel uC for some years now, I have programming experience as a software engineer since 1997, I teach computer science both at high school and university, etc. I even wrote a complete educational Arduino program for high schools all around my country. So I screwed up my first post because of being in a hurry (I should have done better, I agree). I know there are a lot of novice users here, but sorry this topic was a mistake it will lead to nothing. (of course I set the DDR on port B by using pinMode in Arduino). I am a bad reader myself, but a lot of experienced people here don't seem to read my issue and just comment by doing lucky guesses... My mistake. I will just enjoy the fun of Arduino with myself and my always positive, helping and understanding students 
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: Issue with digitalWrite
|
on: July 03, 2012, 09:50:00 am
|
Of course it does, that was my mistake, but that must have been the rush this morning before going to work. I corrected it the way I normally do it, so with parenthesis before the 1 and a closing one before the semicolon. Didn't change the effect (actually I programmed it correctly but posted it here incorrectly). I will use my scope to it to see the effects, but not before tonight. No matter what, I detect a high/low switch when I perform a drigitalWrite(x, HIGH). Not that it matters to me but I thought it would be interesting to you all. I use a recent rev. UNO b.t.w. it could be hardware related of course. PORTB &= ~(1<<PINB5); delay(1000); PORTB |= (1<<PINB5); delay(1000);
No offense, but I consider just exploring it myself and then just share it with my students 
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Issue with digitalWrite
|
on: July 03, 2012, 12:46:08 am
|
I'm creating my own sort of one wire protocol (to drive a attiny10): when I drive the line low for a moment the other side starts reading pulses. So far so good. But I detect that: if I do a digitalWrite(line, HIGH); (e.g. on D12 or D13), the other side starts to respond. it should only respond to a digitalWrite(line, LOW); To confirm this issue I also tried it with: PORTB &= ~1<<PINB5; delay(1000); PORTB |= 1<<PINB5; delay(1000);
That gives exactly the expected behavior. It seems that digitalWrite(x, HIGH) does more than PORTB &= (1 << PINB4); That is very interesting isn't it?!
|
|
|
|
|
9
|
Using Arduino / LEDs and Multiplexing / Re: Charlieplexing issue
|
on: May 19, 2012, 02:59:50 am
|
|
I could of course do multiplexing using the common kathode / common anode method. There is however an extra connection needed to both signals. That way one is able to control all colors more exactly of course. In one signal pole for the Dutch train signal system only one LED needs to be lit.
|
|
|
|
|
10
|
Using Arduino / LEDs and Multiplexing / Re: Charlieplexing issue
|
on: May 14, 2012, 04:47:16 pm
|
|
It seems to be quite hard to compute suitable values for the resistors in the system though. I didn't succeed until now.
When I use 470Ω for A and C and 220 for B and D, one almost can't see the green.
|
|
|
|
|
14
|
Using Arduino / LEDs and Multiplexing / Re: Charlieplexing issue
|
on: May 14, 2012, 12:27:27 am
|
pinMode(ledpinA, OUTPUT); digitalWrite(ledpinA, HIGH); pinMode(ledpinB, INPUT); digitalWrite(ledpinB, LOW); pinMode(ledpinC, OUTPUT); digitalWrite(ledpinC, LOW); pinMode(ledpinD, INPUT); digitalWrite(ledpinD, LOW);
That didn't do the trick unfortunately. Even not with pull down resistors (I understand why my first option didn't work since of course it drew the B and D high instead of low). I could use an XOR port but that makes the circuit more complicated of course...
|
|
|
|
|
15
|
Using Arduino / LEDs and Multiplexing / Charlieplexing issue
|
on: May 13, 2012, 04:22:46 pm
|
I am trying to control two traffic lights using 4 pins and charlieplexing... All modes work save both red (and that should be the initial state so... It gives me two lights with both red and green on. |----->4---------+ | | |-<5-+-<2-+-<1-+ | | | | |->6-|->3-| | | | | | A B C D
Note: > and < are LED's + is just a node A, B, C and D are digital pins on an Arduino 2009
1 and 4 are green 2 and 5 are yellow 3 and 6 are red I use this code: pinMode(ledpinA, OUTPUT); digitalWrite(ledpinA, HIGH); pinMode(ledpinB, INPUT); digitalWrite(ledpinB, HIGH); pinMode(ledpinC, OUTPUT); digitalWrite(ledpinC, LOW); pinMode(ledpinD, INPUT); digitalWrite(ledpinD, HIGH);
A should be +, B input with pull-up activated, C - and D also input with pull-up That way only red should be activated since D is not giving any output, but it is :s Any help appreciated. Below the circuit in Fritzing:  Left signal is straight, right in an L-shape (just the circuit design of course, not the real light...)
|
|
|
|
|