I'd like to use IDE on my desktop to monitor the state of a countdown to zero that repeats every 4 hours in a Uno R3.
Can the Serial Monitor do this and if so, can you suggest some hints on the code to implement?
Thank you!
I'd like to use IDE on my desktop to monitor the state of a countdown to zero that repeats every 4 hours in a Uno R3.
Can the Serial Monitor do this and if so, can you suggest some hints on the code to implement?
Thank you!
It’s possible. Will you be in front of the computer looking at the countdown?
A bit more info on your requirements and context would help us provide good guidance.
The Serial monitor can do this
What number does the countdown start at ?
How often does the number decrement ?
Where are you stuck ?
do you want the computer to take some action when the countdown reaches zero?
if so you will require a program running in the computer which monitors the Arduino serial monitor output and when it reaches zero does something
Thank you for the help:
Here is additional detail............
Thank you for your patience!
On many arduino opening the serial monitor reboots the arduino.., will you keep the monitor open all the time?
Are you on a Mac or Windows or Linux ?
You could just have the count down in a terminal window, no need for an arduino
I have this value that is counting down to start the stepper motor.
delay(14400000);
where can I find the countdown value or the remaining value of the delay value (14400000) to "Serial.print (countdown value)"?
The IDE would be on all the time.
thanks
Delay is blocking the arduino. You can’t do anything whilst it’s blocked.
Use millis ➜ For extra information and examples look at
You did not answer on why you need an arduino for this? You can even find stuff on line like Countdown Timer to Any Date
Please answer the question
Maybe better to use an LCD display for this if you have one. That way, you don't have to worry about the Arduino rebooting.
Or maybe have a servo motor change position to show how much time is left, like a clock hand on an old-fashioned clock. Or something.
Does it have to be the Serial monitor?
the value decrements 1 count/millisecond.
thanks for the help
ok. No, it doesnt have to be the serial monitor. I thought the IDE would be more straightforward as it would be plugged in all the time. I did get a 1602 LCD monitor to try.
here is the code. I hope I copied it correctly. Thank you for the help.
/*
* cheapStepper_simple.ino
* ///////////////////////////////////////////
* using CheapStepper Arduino library v.0.2.0
* created by Tyler Henry, 7/2016
* ///////////////////////////////////////////
*
* this sketch illustrates basic step() functionality of the library:
* the stepper performs a full rotation, pauses 1 second,
* then does a full rotation in the other direction, and so on
*
* //////////////////////////////////////////////////////
*/
// first, include the library :)
#include <CheapStepper.h>
CheapStepper stepper;
// here we declare our stepper using default pins:
// arduino pin <--> pins on ULN2003 board:
// 8 <--> IN1
// 9 <--> IN2
// 10 <--> IN3
// 11 <--> IN4
// let's create a boolean variable to save the direction of our rotation
boolean moveClockwise = true;
void setup() {
// let's set a custom speed of 20rpm (the default is ~16.25rpm)
stepper.setRpm(21);
/* Note: CheapStepper library assumes you are powering your 28BYJ-48 stepper
* using an external 5V power supply (>100mA) for RPM calculations
* -- don't try to power the stepper directly from the Arduino
*
* accepted RPM range: 6RPM (may overheat) - 24RPM (may skip)
* ideal range: 10RPM (safe, high torque) - 22RPM (fast, low torque)
*/
// let's just set up a serial connection and test print to the console
Serial.begin(9600);
Serial.println("Ready to start moving!");
}
void loop() {
// let's move a full rotation (4096 mini-steps)
// we'll go step-by-step using the step() function
for (int s=0; s<28672; s++){
// this will loop 4096 times
// 4096 steps = full rotation using default values
/* Note:
* you could alternatively use 4076 steps...
* if you think your 28BYJ-48 stepper's internal gear ratio is 63.68395:1 (measured) rather than 64:1 (advertised)
* for more info, see: http://forum.arduino.cc/index.php?topic=71964.15)
*/
// let's move one "step" (of the 4096 per full rotation)
stepper.step(moveClockwise);
/* the direction is based on moveClockwise boolean:
* true for clockwise, false for counter-clockwise
* -- you could also say stepper.stepCW(); or stepper.stepCCW();
*/
// now let's get the current step position of motor
int nStep = stepper.getStep();
// and if it's divisible by 64...
if (nStep%64==0){
// let's print the position to the console
Serial.print("current step position: "); Serial.print(nStep);
Serial.println();
}
}
// now we've moved 4096 steps
// let's wait 4 hrs, 1s = 1000
delay(14400000);
// and switch directions before starting loop() again
moveClockwise = !moveClockwise;
}
You mean why Uno R3? It probably could be a Nano. Ill move to a Nano once I get comfortable with the Uno R3.
No, it won't. It will loop 28,672 times.
What kind? Did you get it working with any of the example sketches?
I have tried it yet but its this one.
https://www.amazon.com/gp/product/B07SYPPTWN/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1
OK, it looks like your LCD display uses I2C. I've never used one of those myself, so I'm not sure how much help I can be here, but what you will need to do next is find a tutorial on how to use an LCD with I2C with an Arduino. You will, I expect, need to download a library in order to get the example code given in the tutorial to work correctly.
The important thing here is to be able to get your LCD to display something, even if it's something really lame like "Hello World". Then the next step will be to show the countdown in place of that lame "something".
have a look at arduino-lcd-i2c
try the example programs from liquidcrystal-i2c library
No I mean no arduino at all. You have a computer, it can count… the arduino does not add any value (besides learning how to code and making a project).
But, the OP has a stepper motor (post #8) which he wants to control (using Arduino UNO)?