I'm a student and ı have to make a project. I have done lot of researches about ADC ' s but ı really dont get it. Can anyone please help me atleast 1 part of my project ? I really just want to learn and do my own job.
My project is doing a smart home with especially C language (thats a requirement). All ı want is just controll a led with potentiometer or sensor (lm35&...). I tried to do with Analog Digital Convertor but ı cant find whats wrong. Here is my code;
Use Arduino UNO Board (Fig-1) which contains ATmega328P MCU and enjoy MCU hardware/programming to modulate the brightness of Led as you rotate the wiper of the potentiometer.
Actually ı dont want to control brıghtness what ı want is when potentiometer or sensor like lm35 pass the certain level (potentiometer's half) led should light up.
Looks like you think that will make an LED turn on and off. All it does is make led change from 1 to 0 and back… you have to actually put that on the pin to make the attached LED follow along…
And that code won't compile, there is no declaration of led.
I suggest you to start formatting your code and post it in tags so we can read it better.
Use the </> form the tool bar in the message composition window.
Also I suggest you to use Serial.print() statements to see what values you are getting from the a/d conversion. And other places to trace the flow.
Lastly I ask why? aren't you just using analogRead()?
You could use it to get this working, then if you really feel like you need to start messing with the registers on your hands and knees in the dark crying for help…
Bro ı have to use MicroC , MicroC doesnt have analogread command. I have done lot of researches and all ı found is analogread. If i could use analogread ı dont have to cry for help here sorry for that.
I will post my code ın minutes thank you so much for helping me.
I imagine so. If you follow the rabbit hole far enough, I think you'll get to the nitty gritty of how to command the analog hardware. You may wish to simply copy analogRead and whatever it calls into your MicroC program.
Is it a pure C compiler or will it permit C++ constructs too?