Dear members!
In my project I had to connect a bluetooth module (nRF8001) to my Arduino. The module needs a clock input from Arduino on his SCK pin from Arduino digital pin 13.
When I use the program for the bluetooth alone it works perfectly, but when I use it with my project its not working.
I think the problem is because I use Timer0 and Time1 already in my own project, and Bluetooth wants to use one of those also..
So to make this work I think I have to make the following step:
Set Timer2 to digital pin 13 somehow, so bluetooth will use Time2 and there will be no conflicts.
Does someone know how to do this?
TreasureHunter
Set Timer2 to digital pin 13 somehow
That makes no sense. What you can do is set timer 2 to trigger an interrupt, and, in the interrupt service routine do whatever you want to do to whatever pin you want to do it to.
and Bluetooth wants to use one of those also..
Diddling with some other timer isn't going to work, then. You need to change whatever library "Bluetooth" is to use some other timer.
Though I'm having a difficult time believing that bluetooth uses a timer at all. The bluetooth shield I was using didn't. One communicated with it using the hardware serial instance, Serial, or a SoftwareSerial instance.
then if its not a timer problem we can move on.. I still don't know why the bluetooth doesn't start to advertise. The code doesn't even reach the loop() stage.
In the tutorial it works, in the merged code it doesn't.
In the tutorial it works, in the merged code it doesn't.
In the code you didn't post, stuff doesn't work. So, you want to start changing stuff you don't understand.
It would be far better to post the code, and explain exactly what it does, and how that differs from what you expect.
whoops sorry, this is another topic, I didn't post the code here..
I followed the tutorial of the nRF8001, and tried this code:nRF UART In Detail | Getting Started with the nRF8001 Bluefruit LE Breakout | Adafruit Learning System
It worked for me just fine, but...
I have an existing metal detector code for Arduino UNO that uses Timer0 and Timer1 and interrupts. just the metal detector alone also works fine.
Than I tried to merge the metal detector's code with the nRF8001 tutorial code, you can take a look at the result here: http://pastebin.com/eQAR6h6V
I tried to print out stuff, so I put Serial.println("TEST"); before cli()
and put Serial.println("TEST1"); after sei()
The result was a single "T" appeared on the serial monitor, and nothing more. So I'm stuck here..
you can take a look at the result here
No, I can't. Even if I could, I wouldn't. If you are looking for help on pastebin, that was the place to put the code. If you are looking for help here, the place to put the code is here.
have it crossed your mind, that I didn't paste it here, because it's too long?
No one is looking for help in pastebin, its a website for sending source code to others..
have it crossed your mind, that I didn't paste it here, because it's too long?
Gee, no, that never occurred to me, because you CAN attach it here. There is a sticky at the top of the forum. It's well past time that you read it. You were supposed to read it BEFORE posting here.
Re-read my reply. It starts "Even if I could..". I can't.
TreasureHunter:
No one is looking for help in pastebin, its a website for sending source code to others..
I went to the trouble of writing some forum "stickies" which explains stuff. Like, how to post your code as an attachment. Please take the trouble to read them.