Jump to content

Amos Moses

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Amos Moses

  1. Your comments are duly noted both you and Jen-in-Wellies are right. I am just telling you my experience and why I referred to Arduino books and not C programming books. My Arduino Library is Practical Arduino, Beginning Arduino, Exploring Arduino, Arduino: A Quick Start Guide, Getting Started with Arduino and Arduino Cookbook. My Python library is Automate the Boring Stuff with Python. To programming theory, lots of the best put rough code together to prove a concept and then refine it. For the project being discussed here, the Pico may just work and be simpler to program. I do not know - I have one sitting here but never started it up. The point is getting programs that work first. So, I use wordprocessors - not my own text editor, for example. We all take shortcuts. I have written programs for work that save time and we use daily - but in Python. They work and that is the point. The final issue is learning to program. If you can program, you can learn different languages. I have been programming since 1979, as a hobby, but never got to learning C. I program Arduino's though. If you can learn C, go for it - I would not discourage you. I am just saying what I do. This is showing up for me on the forum.
  2. I have tended to use Arduino programming books. Beginning Arduino: Second Edition (Technology in Action) Paperback – 18 Sept. 2013. by Michael McRoberts is one. Or I look for a sketch on the internet which looks like what i want to achieve. I tend to deny that I know how to write programs in C.... I have done more programming in Python of recent, but find the skills adapt - I just need to remember the syntax. It is also why I am looking at the Raspberry Pi Pico as this is programmed in Python. I find writing a program that works in Python is easier. I hope this helps!
  3. You are worrying me reading Output pins - particularly pin 13. "NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW. If you must use pin 13 as a digital input, set its pinMode() to INPUT and use an external pull down resistor." from https://www.arduino.cc/en/Tutorial/Foundations/DigitalPins. Could you remove the line "int ledState = digitalRead(ledPin); // Reads data from pin (13) and puts in ledState int" and try flipping it another way? TheBiscuits gives the code, which you could try without trying the read pin 13. void loop() { // check to see if it's time to blink the LED; that is, if the // difference between the current time and last time you blinked // the LED is bigger than the interval at which you want to // blink the LED. unsigned long currentMillis = millis(); // Jess's modification if((currentMillis - previousMillis > interval) || (currentMillis < previousMillis)) { // save the last time you blinked the LED previousMillis = currentMillis; // if the LED is off turn it on and vice-versa: if (ledState == LOW) ledState = HIGH; else ledState = LOW; // set the LED with the ledState of the variable: digitalWrite(ledPin, ledState); }
  4. I am testing out the new Raspberry Pi Pico for easier programming. Hopefully.
  5. I would say the issue is with what is triggering the alarm. you say if (readStoke == 0.... But to cancel the alarm you are just silencing the alarm, not resetting the input. So next time is goes around the loop, readStoke will still be 0 as the boiler is still cold. So, this will cancel out pushing the button. You have another issue - 11 delays if readStoke = 0, which is 11 x 500 seconds? So, again, if the program is held in the delay and you push the reset button, it will only see this once out of the delay. Jen-in-Wellies has pegged this and I would refer you to her comments. I would suggest setting a push button "flag" and looping faster without delays. So, if we have a variable "PushButtonFlag" and set this to 0 at the start. Then, if readStroke == 0 and PushButtonFlag = 0 (second if) only then flash the alarm. If you then push the button, this sets PushButtonFlag to 1 so the flashing loop is bypassed. You just need to reset the PushButtonFlag when readStroke == 1 again (i.e. if both are 1). Just suggesting....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.