Show Posts
Pages: 1 2 3 [4] 5 6 ... 66
46  Using Arduino / Programming Questions / Re: Reading serial data without 'terminator' on: June 28, 2014, 07:28:25 pm
It could really help if you tell what kind of machine it is, and if you could find any datasheet.

Maybe the lenght of the answer will be variable, depending on which command was sent, no? For example one command expect an answer of 4 bytes, another command could expect an answer of 32 bytes, whatever...

To read a constant lenght... Basically something like this:
Code:
const uint8_t ANSWER_LENGTH = 20;
uint8_t answer[ANSWER_LENGTH];
uint8_t answer_index = 0;

void loop()
{
  if ( Serial.available() > 0 ) // if there is something in the serial buffer
  {
    answer[ answer_index++ ] = Serial.read(); //read one byte

    if ( answer_index == ANSWER_LENGTH - 1 ) // if there are 20 bytes in the answer array
    {
      answer_index = 0; //reset index for next answer
      //process answer here
    }
  }
}

This is really crappy but should get you started...
47  Using Arduino / General Electronics / Re: Simple help for explaining the rating on: June 28, 2014, 07:03:37 pm
No you have to understand that these are really 2 separate circuits, the arduino only need to provide a small current to the transistor. The transistor need this small current to "link" the 12V power supply and the solenoid, which will "suck" 120mA from that power supply.

To understand better, you have to understand how a transistor work. Look some videos on youtube smiley-wink

And if you are talking about the 2.2 KOhm resistor in the linked tutorial:
Quote
This type of transistor is switched by current and not voltage, so we need to make sure to supply the correct current to the base to switch it, so a resistor is connected from the Arduino to the base to limit the current to the proper amount.

The resistor is not connected to the solenoid, at all smiley-wink
48  Using Arduino / General Electronics / Re: Simple help for explaining the rating on: June 28, 2014, 06:22:42 pm
When given order from the digital Pin on Arduino, the transistor then inter-connects the solenoid and Arduino which finishes the circuit so that now the solenoid is working.

In other words, the purpose of transistor is a switch to separate the circuit connecting solenoid to Arduino unless received order from Arduino saying now connecting. And the resistor is to make sure the 120mA from the working solenoid is lowered to 20mA so that the Arduino will not be fried.  

Am I right.....

No, the arduino control the transistor, and the transistor control the solenoid. Those are 2 separate circuits.

Like... when you turn on a lamp in your house: you are the arduino, the switch is the transistor, the lamp is the solenoid: you never need to touch the wires of the lamp directly, you only need to provide minimal effort with your finger (pressing the switch) to turn on the lamp smiley-wink
49  Using Arduino / General Electronics / Re: Simple help for explaining the rating on: June 28, 2014, 05:50:12 pm
Also read this carefully: http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/
50  Using Arduino / General Electronics / Re: Simple help for explaining the rating on: June 28, 2014, 05:32:06 pm
Hello,

The 120mA is what the solenoid will use (approx), so your 12V power supply must be able to provide at least 120mA. If you have for example a 12V 1A power supply then it's all good. As long as it's at least 120mA smiley-wink.

It's not related to the max current output of the arduino pin.
51  Using Arduino / Installation & Troubleshooting / Re: Arduino IDE rxtxSerial.dll and Arduino Leonardo on: June 28, 2014, 01:29:30 pm
Hello,

I think this problem was fixed in latest Arduino IDE
52  International / Français / Re: Problème avec un écran LCD. on: June 28, 2014, 01:12:25 pm
La seule différence que je vois entre le schéma ci-dessus et la photo de ta notice, c'est que le "Vdd" sur ta notice deviens "Vcc" sur le schéma. Mais les deux termes désignent la même chose smiley-wink
53  International / Français / Re: Problème avec un écran LCD. on: June 28, 2014, 12:41:25 pm
Bonjour et bienvenue,

Je ne comprends pas où tu vois une erreur ?

Il y a aussi cette notice: http://www.produktinfo.conrad.com/datenblaetter/175000-199999/190911-an-01-fr-ecran_rp6.pdf

Dans laquelle il est indiqué que l'écran est "compatible HD44780", c'est à dire que tu peux théoriquement utiliser la librairie LiquidCrystal pour le contrôler.

Mais je n'ai aucune expérience avec ces écrans LCD donc je ne peux pas trop aider plus que ça smiley-wink
54  Using Arduino / Installation & Troubleshooting / Re: ide error message "avrdude stk500_getsync(): not in sync: resp=0x00" on: June 28, 2014, 11:33:18 am
Hello,

Maybe it's a stupid question but, in the Tools menu of the Arduino IDE: did you choose the correct board model, and is the Programmer set to AVRISP MkII ?

Also I can suggest:

- Plug your Arduino to your PC
- Go in Windows's Devices Manager, right click on the Arduino device and click Uninstall,
- Unplug the Arduino from your PC
- Uninstall every Arduino IDE that you tried (basically uninstall everything related to Arduino)
- Restart your PC,
- Install the latest Arduino IDE
- Plug the Arduino to your PC
- Go in Devices Manager and check that the driver has been installed correctly (no yellow exclamation mark)
55  Using Arduino / Programming Questions / Re: Growing numbers to the left on: June 28, 2014, 09:17:32 am
Using what PeterH said about sprintf smiley-wink If previous number is 1234 and new number is 56, the %4d thing will replace "1234" by "  56", overwriting "12" with spaces. No need of if statement. Or maybe I don't understand what you mean smiley-red
56  Using Arduino / Programming Questions / Re: Growing numbers to the left on: June 28, 2014, 08:49:31 am
It should replace the previous digits with spaces. Which LCD, and which library are you using ?
57  International / Español / Re: limpiar puerto serial on: June 27, 2014, 05:20:34 pm
Hola y bienvenido, tiene que escribir en Inglés, o pregunte en este foro: http://forum.arduino.cc/index.php?board=32.0 smiley-wink

Pero es imposible de borrar el monitor serial de la Arduino
58  Using Arduino / Programming Questions / Re: Reading "Serial Data" on: June 27, 2014, 05:25:00 am
Don't use delays, also don't use Strings. I suggest you read this page: http://gammon.com.au/serial

Or, maybe easier, use something like this example: http://forum.arduino.cc/index.php?topic=137250.msg1031430#msg1031430
59  Using Arduino / Project Guidance / Re: Serial communication between FTDI basic breakout (5v) and Arduino Leonardo on: June 27, 2014, 05:14:05 am
Serial.read returns a byte, so you have to tell your arduino program that you want to use a char instead.

Change this:
Code:
int matlabData;
...
Serial.println(matlabData,DEC);

to this:
Code:
char matlabData;
...
Serial.println( matlabData );


Or, if you really want to read the data as an int, you can just cast it to a char just for printing it:
Code:
int matlabData;
...
Serial.println( (char)matlabData );
60  Using Arduino / Project Guidance / Re: Serial communication between FTDI basic breakout (5v) and Arduino Leonardo on: June 26, 2014, 08:25:12 pm
Sorry if I was mistaken about Serial1. I though it was for Arduino Mega only smiley-wink
Pages: 1 2 3 [4] 5 6 ... 66