How would I control an Arduino UNO via serial without the IDE?
By sending it commands from another app. Could be a terminal program, could be a program written in your language of choice, could be Excel(with help). You need to tell us more about what you want to do.
Led rope in question
library used
control program used
#include "TinyIRSender.hpp"
int value;
void setup() {
Serial.begin(9600); // send and receive at 9600 baud
Serial.println("<Arduino is ready>");
}
void loop() {
if( Serial.available())
{
char ch = Serial.read();
if(ch >= '0' && ch <= '9') // is this an ascii digit between 0 and 9?
{
value = (value * 10) + (ch - '0'); // yes, accumulate the value
}
else if (ch == 10) // is the character the newline character
{
sendNEC(3, 0, value, 1); // Send address 0 and command <value> on pin 3 with 2 repeats.
}
}
}
With the Arduino connected to the USB port, enter a number, 0 through 99.
I want to control it using bash commands
That is going to be tricky. Each time that you do something like echo "hi" > /dev/ttyUSB0
your Arduino will reset if you use the built-in USB of the Arduino
To prevent that, you can use a serial-to-usb converter connected to the RX and TX pins of the Arduino. Be aware that this will interfere with upload using USB.
Or hack the Arduino (which will make uploads even more tricky).
You're probably better of using a terminal program.
all i need is for the program to execute once and then reset since I already have pin 4 set to toggle the reset pin since it has to reset otherwise it stop responding for some reason
question i have : does the Arduino reset before or after the the code runs?
Every time the port is opened. The below will result in two resets.
echo "hello" > /dev/ttyUSB0
echo "world" > /dev/ttyUSB0
what terminal programs would you reccomend?
After a long absence from Linux I recently started to use it again.
I suggest that you go to your package manager and install a few and try them out.
I've recently installed minicom (command line might be installed by default in your distro), putty and cutecom but haven't used them much yet.
On Linux you always seem to suffer from the fact that opening the serial port results in a reset. Terminal programs under windows often offer the option to prevent that.
so heres my idea,
- open serial port
- wait for reset
- send data
- close serial port or whatever
will this work?
It will, but a better idea is to have the Arduino send something to tell you PC program that it is ready to go!
all i want to do is what i listed, I plan to make this a set it and forget it system for controlling a light strip,
You have had several suggestions. Let us know when you have it working.
MCUs do not need to use the serial port to start, only power. Once you set it (the MCU) you can forget it.
it takes serial input, i want to automatically (without opening Arduino IDE) send serial commands to my arduino
Does bash do serial data transmissions?
yes, see post #8.
Thanks, I did not know what was meant by bash. Same stuff we did with MS DOS, so many years ago. Guess we also did it with other MS operating systems, just not very often. OP needs to branch out into Python or something else for his PC connection.
my program takes serial input, i want to automatically (without opening Arduino IDE) send serial commands to my arduino