Show Posts
Pages: 1 2 3 [4] 5 6 ... 302
46  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 11:11:00 pm
Do you still have the master doing

Serial.write("3");

Because that string "3" would send 2 bytes: '3' and a terminating NULL (as values 51 then 0 ).

You want to

Serial.write('3');

47  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 11:01:27 pm
It's also a hell of a lot cheaper and quicker!

I learned basic electricity and some electronics over 40 years ago. We learned to wire up automation circuits, even logic gates and flip-flops from discrete parts and tubes along with transistors. It's amazing how much can be done with simple, cheap parts and wires though at some point a package like an AVR, even an ATtiny, can replace a load of those. But for simple shizzle, direct circuits are the way to go.
48  Using Arduino / Programming Questions / Re: HELP on PWM programmed on: April 15, 2014, 10:53:05 pm
One thing you don't want to do is pull over 200 mA through the Arduino, and try to pull 20 mA or less through any 1 pin.

With PWM you can make every led attached through the PWM pin to be ON over a duty-cycle. PWM goes on/off about 490 times a second. So ALL your leds can be ON like 0% of the time up to 100% in 256 steps. You can make them all dimmer than a 15 year old in 6th grade if you want so why bother shutting just some of them off?

Really, use PWM to control a transistor that runs maybe 12V through the collector-emitter and a resistor for each led and have the LDR reading determine what duty cycle to run the PWM.

This Playground project uses a led as both light and sensor, but adjusts brightness for the eyes... it dims in the dark and brightens in light. The circuit is used in TV remotes and cellphones to save power and be eye comfortable. You would want almost the opposite but check out how it's done!
http://playground.arduino.cc/Learning/LEDSensor
49  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 10:31:26 pm
Still no MCU.  smiley-cool

50  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 10:26:31 pm
You left out the caveat that special case apps only fit special cases and can screw up other sketches.
51  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 10:08:15 pm
Quote
I don't know much about coding the car or anything so is there any advice on that that you guys have? Sorry for such a novice post.   

I guess it was this comment that threw me off track...

You may be right. I'd be thinking some sort of sci/tech/eng course in HS or freshman uni.

BTW, check this out: http://www.instructables.com/id/Build-a-SpurtBot-Line-Follower/
I'd drive the wheels a bit differently (motor axle with heat shrink directly on the wheel), and use different wheels but this one is even simpler than I was thinking!
Note it only turns to the right, a line follower than W.F.Buckley could love!

52  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 10:01:37 pm
Because coordinating use of a serial channel is easier than using separate channels?
Only in special case apps. Otherwise more trouble than it's worth.

As for Strings... you have been shown again and again about those and Arduino.

Yes, there are BAD practices that can be gotten away with. And then comes the help needed posts where as usual part of the fix is an OP UN-learning stupid/wasteful/bad habits before they can write their non-trivial projects.

Damage control? Yeah, to try and cut the HOURS WASTED over stupid/wasteful/bad practices.
53  Using Arduino / Programming Questions / Re: Having trouble "inserting" new characters to a String object. on: April 15, 2014, 09:44:06 pm
The function-local dMessage is wiped out when the function ends, it has gone out of scope. So when the code gets the return (an address to the object) the object is gone.

Thanks for the clarification.  That sounds like nikosk's problem (Strings not withstanding).  Guess I was confused.

Regards,

Brad
KF7FER

The quick and dirty fix is to make the string global, which never goes out of scope.
54  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 09:42:41 pm
It is limited and it is more trouble than it's worth. Same as using String Objects on an UNO.

Quote
You can't have the Arduino to Arduino serial on the same pins that one of the Arduinos uses to Serial Monitor.

Sure you can. I've used the below test code on two arduinos appropriately connected tx/rx/gnd. What is typed in the master serial monitor and sent to the master is echoed back to the master serial monitor and also appears on the slave serial monitor. To make the slave operate the same way to the master, put a diode in the slave tx line with the diode band toward the slave tx pin.

Code:
//zoomkat 3-5-12 simple delimited ',' string tx/rx
//from serial port input (via serial monitor)
//and print result out serial port
//Connect the sending arduino rx pin to the receiving arduino rx pin.
//Connect the arduino grounds together.
//What is sent to the tx arduino is received on the rx arduino.
//Open serial monitor on both arduinos to test

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.print(readString); //prints string to serial port out
        Serial.println(','); //prints delimiting ","
        //do stuff with the captured readString
        readString=""; //clears variable for new input
      }
    }  
    else {    
      readString += c; //makes the string readString
    }
  }
}

55  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 09:39:52 pm
And be double sure that you have both Arduinos and any external power ALL on a common ground!
56  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 09:38:22 pm
For the type of serial you are using a serial channel should only have two ends that nothing else uses those pins.

It would be best if you leave RX and TX for the USB chip and cable for use or test/debug and set up a separate channel/set of pins for each other link.

You have Slave with channel to PC, channel to BT and channel to Master Arduino? Then the Slave should have 3 serial channels whether hardware or software serial and only the one to the PC uses RX/TX. The Master needs one channel for test/bebug and another for channel to Slave.

You get clean commo that way.
57  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 09:27:22 pm
Quote
  I have  a school project where we have to control an  RC car autonomously.   

My bad. Silly of me to think that an autonomous car would use a uC. What was I thinking ?

It doesn't need one if you use DC motors.
It's funny how many $20+ solutions there are to $2 to $5 problems.
58  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 09:21:36 pm
Quote
  No, you don't have to code the project. You could wire the thing directly, electro-mechanical, 

I don't think that would fly with their computer class professor.

What computer class? What professor?

We are told of a class project but what is the class? I sure HOPE that intro to programming doesn't start with "make a robot car". This student knows zero about coding and apparently there is no programming requisite to the course.

We don't even know what year/grade this student is in or what background knowledge he/she can draw upon.

So the simple thing would be a wired automation using transistors as AND gates where needed.

BTW, the Sparkfun sensor is nice but an IR or other led, resistors and IR or light detector cost far less... IIRC even at Radio $hack. But you'd have to put them together and make it work which that sensor module has done already.

Note that the line follower bot they show uses 3 of the line follower sensors, $9 right there. Yeah, I could do better for less :-P but then I have a lot of background to draw upon.

59  Using Arduino / Project Guidance / Re: Inconsistent values with Bluetooth and Serial.Read on: April 15, 2014, 08:43:20 pm
How is that wired?

You can't have the Arduino to Arduino serial on the same pins that one of the Arduinos uses to Serial Monitor. If you try, you only make something that steps on itself.

What you need to do is set up a separate serial link for every serial connection, like PC to Arduino to Arduino to Bluetooth needs 3 separate serial channels to accomplish.

With UNO's you can use SoftwareSerial to make serial links besides the USB cable link. With MEGA you have 3 extra hardware serial ports.  SoftwareSerial is one of the standard Arduino libraries that comes with your IDE.
60  Using Arduino / Project Guidance / Re: RC Car - following tape using sensors on: April 15, 2014, 08:24:28 pm
Maybe one of these can help:
http://www.instructables.com/howto/line+follower/

Seriously, how long do you have to spend on this as to deadline weeks and hours per week?

No, you don't have to code the project. You could wire the thing directly, electro-mechanical, if the drive motor and steering are straight DC. But you would need to know or learn basic DC electric (which you would with a controller too) unless you can find a "cookbook recipe".

What is the object of the class project? Teach students to find and copy from the internet? Please if you could relay to your teacher that if that is so then the course is the kind of crap that's running the world to the trash heap, okay?

If you do have a long lead time then don't waste it because you have a lot to learn!
Pages: 1 2 3 [4] 5 6 ... 302