
Uluroki
-
Content Count
6 -
Joined
-
Last visited
Posts posted by Uluroki
-
-
I didn't have much time in the past few days, but now I'm back to the project.
Note- a pull-down resistor (10K-100K) should be installed between P1.7 and ground in order to bring the ADC to 0 if no battery is connected, otherwise noise / jitter on the ADC can cause random fluctuations and false readings. Also, note the use of nested if...then...else; when the first condition is satisfied, no other tests are done, so if the first fails, the second is tested and if that fails the final else is what happens.
I don't understand how it should be connected... I've modified a bit my board, looks like this now:
Those 5 resistors are 2,2k Ohm each. Also, I'm printing voltage from the input pin to serial (with no battery plugged), and getting readings like
Voltage=0.38 Voltage=0.41 Voltage=2.11 Voltage=0.36 Voltage=0.39 Voltage=2.09
...and like so. I've also added the line "analogReference(DEFAULT);" in setup. I guess I'll just test a 100k resistor, hopefully it'll help.
-
Ok, I've got the GND connected, but still the LEDs don't seem to react to the battery :/
The red led is LOW, the yellow and green HIGH.
This is the code now:
#define VOLTAGE_0_8 (int(1024.0 / 3.4 * 0.8)) #define VOLTAGE_0_4 (int(1024.0 / 3.4 * 0.4)) const int newLED = 11; // green LED 'new' const int okLED = 12; // yellow LED 'ok' const int oldLED = 13; // red LED 'old' int analogValue = 0; float voltage = 0; int ledDelay = 2000; void setup() { pinMode(newLED, OUTPUT); pinMode(okLED, OUTPUT); pinMode(oldLED, OUTPUT); } void loop() { analogValue = analogRead(0); //voltage = analogValue*0.0033; if (analogValue >= VOLTAGE_0_8) { digitalWrite(newLED, HIGH); } else if (analogValue < VOLTAGE_0_8 && analogValue > VOLTAGE_0_4) { digitalWrite(okLED, HIGH); } else if (analogValue <= VOLTAGE_0_4) { digitalWrite(oldLED, HIGH); } else { digitalWrite(newLED, LOW); digitalWrite(okLED, LOW); digitalWrite(oldLED, LOW); } }
-
Well, I'm doing something wrong...
The top led is red, the middle is yellow, the bottom is green.
This is what I've got, but the board is ignoring the battery (I've got one, not two), by blinking the green & yellow leds even if no battery is connected at all.
I just don't understand :/
This is the code I'm using:
const int newLED = 11; // green LED 'new' const int okLED = 12; // yellow LED 'ok' const int oldLED = 13; // red LED 'old' int analogValue = 0; float voltage = 0; int ledDelay = 2000; void setup() { pinMode(newLED, OUTPUT); pinMode(okLED, OUTPUT); pinMode(oldLED, OUTPUT); } void loop() { analogValue = analogRead(0); voltage = analogValue*0.0033; if (voltage >= 0.8) { digitalWrite(newLED, HIGH); } else if (voltage < 0.8 && voltage > 0.4) { digitalWrite(okLED, HIGH); } else if (voltage <= 0.4) { digitalWrite(oldLED, HIGH); } else { digitalWrite(newLED, LOW); digitalWrite(okLED, LOW); digitalWrite(oldLED, LOW); } }
Any advice, please?
-
Thank you very much
I'll let you know how it went
-
Hi all,
I am new to MSP430 (and basically, topics on this forum) and I will probably ask some stupid questions, but I have to ask them anyway
I just got myself a Launchpad, and I want to run this project http://nostarch.s3.amazonaws.com/arduino_project6.pdf
using Energia.
My questions are:
1) If I copy the Arduino code, change the connected pins in the code from D2,D4 and D6 to 6,7 and 8 base on this reference (P1.4, P1.5, P2.0) http://energia.nu/img/LaunchPadMSP430G2553-V1.5.jpg and connect it, will it work?
2) Do I have to use 3 x 560 Ohm & 1 x 2,2k Ohm resistors, as shown od the Arduino schematics? ATM (writing these words) I have
only the board, I have to buy LEDs and resistors and a prototype board so I can't test anything yet.
3) I wanted to use the MSP430G22553 20-pin device. Is it ok?
I have the Rev.1.5 Launchpad.
About movement and communication
in General
Posted
Hello,
I've got two beginners questions...
1) If I'd want to move a robot by a specific distance (however not be very precise), do I need wheels with encoders? Can't I somehow approximate the time I need to power the engine? I don't need to move exactly 1mm left or right. I've read about encoders, but they are too expensive for me.
2) If I wanted to control a robot from an Android app via bluetooth, could I send some data from the robot to my phone, process the data (on the phone) and send something (an instruction, lets say) back to the robot?
Sorry for my English.
Thanks in advance.