So my problem is that, for now, both loops run at the same frequency (around 200Hz). The inner loop could run alone at (I guess) around 300Hz. And I would like the outer loop to run at around 50Hz. But I don't know how to structure my code to obtain this. I looked at your code, but it's not very clear to me how you do it.
Well I do it by reading millis() and comparing that to the value 1000/FREQ (which equals to the duration of each loop in milliseconds).. For example:
Sorry for the late reply. The pcb is powered from my arduino so it's the same ground. I have pads connected to TX, RX and RST with a hole through them, wires are soldered to these pads and connected directly to my arduino. I don't have a rst cap, but I've honestly never had a problem with this before (my DIP chips don't need them at least)..
You need the reset cap.. without it the mcu will stay in the reset state (because serial is pulling the reset low while it is open! )... The cap will allow the the reset pin to go low for a brief moment (until it is charged via the 10K resistor connected to Vcc and rst) before it gets charged and goes high..
Try this to test if the missing cap is the problem: disconnect the DTR pin and manually reset the mcu before uploading.. did it work? In that case put the cap where it belongs
You'll also find example code in the library =).. The library doesn't support the BMP085 yet.. So you can get the values from the accelerometer, gyrometer and magnetometer.. The reason for the lack of support for the BMP085 is that I haven't had any use for it yet.. Maybe in the future =)!
hello, I am sankha. i made qudocopter using Arduino mega board. i am trying to make that using this code. but this code has compiling errors and i cant to find circuit diagram..... please help me to bild ub this qudo copter..... thank you.
I've provided the circuit for the different connections in the attachment of my first post.. So go back and look at it.. The code is written for the arduino leonardo/micro.. And won't work out of the box with the mega..
I've got a lot of private messages like this, where people have tried getting this code running on boards other than leonardo/micro.. I'll rewrite/add the missing pieces, to the code in-order for it to work with the UNO and MEGA if I can get any volunteers that can test the code for me on their quadcopters..
i changed the motors to 3 9 10 11 pins and throttle to pin 2 and other 3channel to 4 5 6 i think the interupt of arduino is pins 3 isnt it ?
I'm currently at work.. But i'll look at it as soon as I get home.. Will you be so kind and post all your code changes so I can take a look at them??? Just zip the whole project and post it here...
Edit: Just got back from work.. i looked over your pin choices.. Well yes the interrupts are on pin 2 and 3.. So that also means that you can't use pin 3 for one of the motors.. Why not leave the motor pins as is??? Did you write a new interrupt routine for the receiver? Because the current one won't work on the UNO..
It should say Arduino UNO because the name is set in the makefile as Arduino UNO, so no problems there... Will you for the sake of it download Arduino 1.0.5 and try those drivers.. Because the drivers in arduino 1.0.5 are signed drivers.. Maybe that will skip some of the windows errors that come up..
i changed pins because i use arduino uno and i think problem caused bcuz of that .....
Hmm, then what pins did you change to?? You can find the pins definition in the Config.h file.. The throttle is on pin 7.. And it's a interrupt pin on the leonardo.. Did you come around the receiver code, and in that case did you implement it in the firmware???
If you need further help then please provide me with everything you have, so I know how to formulate my answers..
Well, you need some kind of linux environment in-order to make that particular project.. I used cygwin, which is some kind of linux shell for windows (http://www.cygwin.com/).. From there all I had to do is go into the directory for the makefile using "cd" and then type make!
However, the board (atmega8u2) worked fine initially with 16 MHz crystal I changed it to 8 MHz crystal, and then it failed.
It's not as simple as just changing the crystal and expect it to work.. The clock has to be changed in the firmware also.. I changed the clock to 8Mhz and recompiled the firmware for you.. This firmware is only for the USB serial, without the DFU.. Try it out and report back..
I had some free time this weekend, so I just made something I wanted for a long time!!......... Some background action for my PC monitor!
I know this idea isn't new, but I believe my approach/results is somewhat different than the standard Ambilight clones out there..
This is a simple ambilight clone that anyone can make.. What you need is a LED RGB strip with WS2801 or WS2811 (though the code is written for the WS2801) , a arduino and a PC with processing 2.0+..
The strip I used has 32 LEDs and the sketch is written for 32 LEDs.. This can easliy be changed by changing the "number of LEDs" constants on the arduino and processing side..
The code expects the leds to be divided on three sides of the screen.. I have 16 LEDs on the top of the screen and 8 on the left and 8 on the right side.. Led number 1 is on the right-bottom side of the screen and led number 32 is on the left bottom side of the screen..
The strip is connected as follows to the arduino:
MOSI (Arduino) <-----> DI (Data input LED Strip) SCK (Arduino) <-------> CLK (Clock input LED Strip) 5V (USB, ARDUINO) <-------> 5V input on LED Strip GND (Arduino) <--------> GND input on LED Strip
Now before I continue, words of caution! The Strip is powered by USB in my case, and is working fine because I turned down the brightness of the LEDs.. This can be set in the the processing sketch by changing the variable Brightness.. if you're using 32 LEDs like me, then a value of <110 is okay! Still, if you're unsure then set the value to 64, or power the strip externally...
Open the sketch MakeMeLight.ino in the arduino folder and hit compile followed by upload..
Now start the processing sketch with MakeMeLight.pde (in the processing folder) and hit the "Run" button..
You'll get a simple GUI with four button.. Two buttons for the Sound Mode and two for the display mode.. (See screenshot in the attachments)..
The Sound mode is a VU-meter for the PC speaker output.. So it'll react to the music/sound you're playing.. The left side of the screen will represent the left speaker volume, and the right side of the screen will represent the right speaker volume..
The Display mode is a dynamic ambilight mode.. The meaning with dynamic here is that it reacts "better" to color change compared to other ambilights out there.. If you look at other software ambilight projects, you'll see that they average a chunk of the screen in order to get a high FPS (frames per seconds, or in this case updates per second).. The negative outcome from this is that the ambilight will somewhat feel very static/very still/very boring..
In my case I chose to only average 5 pixels per LED and came out with a average FPS of 20.. The next question you'll ask yourself, why so slow??? Considering that this is a software ambilight (the pixel data is read by getting screenshots of the screen and processing that image) this is a very okay frame rate.. And believe me, you won't notice any flickering.. I made sure of that!
In sound mode, the FPS is around 700-1000 FPS.. The reason is that reading sound data is a fast process, very fast compared to taking screenshots...
Another plus here is that the PC software is written in processing, meaning it's auto cross-platform! =)
I've added some pictures of the LEDs on my screen and the final setup..
Here is some clips demonstrating the two modes:
Display mode: Sound mode:
If you've got any question please feel free to ask!