- Posts: 291
Extra inputs for Devo Tx's
- Epitaph
- Offline
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(0, OUTPUT); //LED on Model B
pinMode(1, OUTPUT); //LED on Model A
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, HIGH);
delay(1000); // wait for a second
digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
digitalWrite(1, LOW);
delay(1000); // wait for a second
}
In any case, I can't really try much out till the pots arrive, I'm just trying to do a little homework in the mean time heheheh
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Cereal_Killer wrote: Hi again Deal, my code it to long to PM you...
As of now switch D1 operates as a 2 way moving Ch PPM3 between -108 and 0 (switched from low to mid, switching it up does nothing),The second 3-way does the same thing. This is your code from page 4 with the stuff I dont use removed and the snipit you posted above added in at the end (original DigitalRead lines removed)
...
Hmm... are you sure that the 3-way switch is connecting the center to ground, and the other pins to D6 (swPin_D1) and D7 (swPin_D2)? Can you disconnect the second switch for now, so we can get one working? It sounds like maybe you're reading one pin from each switch, which I think would give you this behavior.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
sketch_dec08a.ino: In function 'void setup()':
sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope
sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope
sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope
sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope
sketch_dec08a:62: error: 'TIFR1' was not declared in this scope
I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Deal57 wrote:
Cereal_Killer wrote: Hi again Deal, my code it to long to PM you...
As of now switch D1 operates as a 2 way moving Ch PPM3 between -108 and 0 (switched from low to mid, switching it up does nothing),The second 3-way does the same thing. This is your code from page 4 with the stuff I dont use removed and the snipit you posted above added in at the end (original DigitalRead lines removed)
...
Hmm... are you sure that the 3-way switch is connecting the center to ground, and the other pins to D6 (swPin_D1) and D7 (swPin_D2)? Can you disconnect the second switch for now, so we can get one working? It sounds like maybe you're reading one pin from each switch, which I think would give you this behavior.
Yes I'm positive, I even have them labeled on the TX body with a sharpy cause I thought the same thing but I will physically disconnect the second switch today (I'm on my way out the door for a back dr appt now).I have also verified with a DMM that the pins are being pulled low when the switches are in the different positions.
Thanks for your help so far, will respond back with results of test this afternoon. I'm also posting on Ian Johnson's forum.
For my clarification, what does "!=" mean in arduino language? I cant find it referenced, I would of thought it should be written as "<=" and ">=".
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Epitaph wrote: I just loaded it into the Arduino IDE a moment to load onto the Digispark as that takes all of 5 seconds to do, and I got this error
sketch_dec08a.ino: In function 'void setup()': sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope sketch_dec08a:62: error: 'TIFR1' was not declared in this scope
I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem
Ouch. Yeah, I was wondering about the interrupt handling. We may just need a library, or it may be a show-stopper . Here's a discussion of the options. Given the nature of PPM I'm not really comfortable with the solution shown there because it's just a loop. It may be OK for our purposes, but I can't mess with it until my digispark gets here.
Off to google some answers...
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Epitaph wrote: I just loaded it into the Arduino IDE a moment to load onto the Digispark as that takes all of 5 seconds to do, and I got this error
sketch_dec08a.ino: In function 'void setup()': sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope sketch_dec08a:62: error: 'TIFR1' was not declared in this scope
I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem
What are your clock setting in the tools pull-down? Is the digispark an actual board option or are you compiling as a raw ATTINY? All of the times will either need adjusted to the clock speed you choose or you'll need a attiny85 include.
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Epitaph wrote: The board select is "Digispark (Tiny Core)", and the programmer is down as "Digispark", which is how it has to be set up according to the information I have found on Google.
I literally just saw that it has its own board type options. Which one specifically are you using? AVR timers are a whole other subject on their own. You definitely don't want to be using the standard option (that runs at 16.5mhz) (point 5, really?! Lol). I'd start trying with the digispark pro running at 16mhz.
These things don't have xtals on board do they? They're using the internal oscillator? You may never be able to get a clean PPM stream out of them (not making that claim or trying to put you off, the attiny85 is a really amazing little micro in general but as with all the small attiny's clock speed fluctuates pretty badly depending on temp and just in general from chip to chip)
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
We aren't actually even using the interrupt routines in this code, so you can try it by commenting out that whole section. It compiles just fine... don't know if it works! I found some other timer options so I'll keep plugging away.
I had no problem getting the DS libraries/board definitions loaded into my IDE 1.6.5. Setup process is quick here .
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Here's code with updated timer setup. The Digispark system uses Timer1 so we have to use Timer0. Several people who sounded much more knowledgeable than I suggest this:
TCCR0A = (1 << WGM01); //CTC mode
TCCR0B = (2 << CS00); //div8
OCR0A = F_CPU/8 * 0.000050 - 1; // 50us compare value -- we need to fix to 22ms next
TIMSK |= (1<<OCIE0A); //if you want interrupt
Then we can use this:
ISR(TIMER0_COMPA_vect) {
ppmoutput(); // Jump to ppmoutput subroutine
}
It compiles. Again, don't know if it works.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
EDIT
I just tried it again a couple more times, and it loads successfully with the 16mhz-default setting using USB TinyISP as the programmer, but gives the timer error with any other combination, including the 16.5mhz-default setting.
Now all I have to do it wire it in and see if it works, but I can't right now...
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Deal57 wrote: I'm pretty sure you want to be on IDE 1.6.5 or .6.
Here's code with updated timer setup. The Digispark system uses Timer1 so we have to use Timer0. Several people who sounded much more knowledgeable than I suggest this:
TCCR0A = (1 << WGM01); //CTC mode TCCR0B = (2 << CS00); //div8 OCR0A = F_CPU/8 * 0.000050 - 1; // 50us compare value -- we need to fix to 22ms next TIMSK |= (1<<OCIE0A); //if you want interrupt
Then we can use this:ISR(TIMER0_COMPA_vect) { ppmoutput(); // Jump to ppmoutput subroutine }
It compiles. Again, don't know if it works.
I loaded it in no problem under 16mhz without this alteration, but I can't test it right now to see if it actually works...
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
EDIT
Nothing... no joy whatsoever... no signal on any of the channels at all.
If I need to change the timer code to your revised code, where does it go and what does it replace?
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Deal57 wrote: The "!=" is "Not equal". In this case you might be able to use "== 0" instead of "!= 1". It probably works either way.
Ok I'm home now and have physically removed the second switch, still the same behavior.
I dont understand why it works on yours and not on mine. Or is my thinking incorrect and you actually want your 3-way switches acting to switch two different channels so you dont have to deal with this?
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Epitaph wrote: I've just tried out sketch on my Uno, adjusting the inputs and outputs obviously, just to make sure that there was nothing faulty with the rest of the hardware like the mono jack lead or the pots, and it works fine with the Uno, I see all the channels working great, so the problem is definitely in the Digispark.
Try this. I've put the timer and interrupt code into the sketch. Glad to hear the basic code works on the UNO, so that means we need to resolve this timer/interrupt thing.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- Extra inputs for Devo Tx's