Ned

Members
  • Content Count

    7,707
  • Joined

  • Last visited

  • Days Won

    1

Ned last won the day on November 14 2015

Ned had the most liked content!

Community Reputation

3,481 Excellent

About Ned

  • Rank
    Old different face
  • Birthday 29/01/1986

Contact Methods

  • Website URL
    http://www.club-k.co.nz

Profile Information

  • Gender
    Male

Converted

  • Local Area
    Auckland

Recent Profile Visitors

1,400 profile views
  1. Ned

    Arduino stuff/ programing/so cheap

    mechanical switches bounce, thats just the nature of them. Add SW debouncing by checking the signal is valid for 30mS or something, or do hardware debouncing with a 100nF capacitor across the switch and a weak pullup? 10k or bigger maybe? i dont usually do HW debouncing as it costs more than a few lines of code so might pay to google a bit....
  2. Ned

    Arduino stuff/ programing/so cheap

    or even change the defines to this: #define TEMP_BAND 2 #define TEMP_MINOR 24 #define TEMP_GENERAL 28 #define TEMP_DIRE 32 #define INCR_MINOR (TEMP_MINOR) #define INCR_GENERAL (TEMP_GENERAL) #define INCR_DIRE (TEMP_DIRE) #define DECR_IDLE (TEMP_MINOR - TEMP_BAND) #define DECR_MINOR (TEMP_GENERAL - TEMP_BAND) #define DECR_GENERAL (TEMP_DIRE - TEMP_BAND) and it will fire the error as soon as it happens, but wont 'clear' it until it's gone lower by the deadband
  3. Ned

    Arduino stuff/ programing/so cheap

    You can change TEMP_BAND from 2 to 1 to lower the deadband, and then it will be 'faster' you can also remove or lower the delay, as it only sends stuff when stuff changes, so wont bombard the serial port as much probably
  4. Ned

    Arduino stuff/ programing/so cheap

    it looks like it has some weird character in between the # and the define part? maybe try re-writing it as a copy/paste might be putting some weird shit in there from the interwebs? Wont need a library or anything https://www.arduino.cc/reference/en/language/structure/further-syntax/define/
  5. Ned

    Arduino stuff/ programing/so cheap

    ok, try this (i havent compiled it, so might have the odd error, but should give you an idea/starting point) #define TEMP_BAND 2 #define TEMP_MINOR 24 #define TEMP_GENERAL 28 #define TEMP_DIRE 32 #define INCR_MINOR (TEMP_MINOR + TEMP_BAND) #define INCR_GENERAL (TEMP_GENERAL + TEMP_BAND) #define INCR_DIRE (TEMP_DIRE + TEMP_BAND) #define DECR_IDLE (TEMP_MINOR - TEMP_BAND) #define DECR_MINOR (TEMP_GENERAL - TEMP_BAND) #define DECR_GENERAL (TEMP_DIRE - TEMP_BAND) enum warningStates_t {IDLE = 0, WARN_MINOR, WARN_GENERAL, WARN_DIRE}; warningStates_t curState, oldState; void loop() { thermoSensorNewVal = thermoSensor.readCelsius(); if (thermoSensorNewVal != thermoSensorOldVal) { Serial.print(" C = "); Serial.print(thermoSensorNewVal); thermoSensorOldVal = thermoSensorNewVal; } switch (curState) { default: curState = IDLE; /* should never happen, but good practice to have a default */ case IDLE: if (thermoSensorNewVal >= INCR_MINOR) curState = WARN_MINOR; break; case WARN_MINOR: if (thermoSensorNewVal <= DECR_IDLE) curState = IDLE; if (thermoSensorNewVal >= INCR_GENERAL) curState = WARN_GENERAL; break; case WARN_GENERAL: if (thermoSensorNewVal <= DECR_MINOR) curState = WARN_MINOR; if (thermoSensorNewVal >= INCR_DIRE) curState = WARN_DIRE; break; case WARN_DIRE: if (thermoSensorNewVal <= DECR_GENERAL) curState = WARN_GENERAL; break; } if (curState > oldState) { // Increased temp warnings switch (curState) { case WARN_MINOR: tempWarningMinor(); break; case WARN_GENERAL: tempWarningGeneral(); break; case WARN_DIRE: tempWarningDire(); break; default: break; /* should never happen, but good practice to have a default */ } } if (curState < oldState) { // Decreased temp warnings switch (curState) { case IDLE: /* Could do an 'all clear' message here */ break; case WARN_MINOR: tempWarningMinor(); break; case WARN_GENERAL: tempWarningGeneral(); break; default: break; /* should never happen, but good practice to have a default */ } } oldState = curState; delay(1000); } // end of loop So made a few changes for you. 1) the value being output by your serial debugger is the value actually used for the comparing (before you would re-read it) 2) it will only print out the temperature if it has changed 3) state machine based, so it will only fire each warning once 4) added some defines so you can easily change the values all in one place. How it works is when it's in a state (like IDLE) it will only look for one thing... and that is "Is it hot enough to fire a Minor warning?" and if it is, it sets the state to WARN_MINOR and will fire off that warning. Now the state is WARN_MINOR and now it does 2 things. "Is it cold enough to go back to Idle?" and "Is it hot enough to go to WARN_GENERAL?" If so, it changes the states accordingly. The warnings are sent using the oldState and the curState. So if they are ever different, it will fire a warning. And it checks to see if the state is going up or down, so you can do different warnings for going up and going down if you like
  6. Ned

    Arduino stuff/ programing/so cheap

    You want what they call a state machine. Im on my phone and dont wan a write code on it haha but will help out if you're still stuck Monday
  7. Ned

    Arduino stuff/ programing/so cheap

    why not use structs? typedef struct screenValues_t { uint16_t speed, rpm, tp, wb02; int16_t iat; } screenValues_t; screenValues_t oldScreen, newScreen; // copy all the current data into the old one memcpy(&oldScreen, &newScreen, sizeof(screenValues_t)); // do stuff with things? if (newScreen.rpm != oldScreen.rpm) { // have a dance }
  8. I have a couple nice supplies here already. Next one will be a high current one (like 30A) i think... China has some affordable ones... But you sure it's not the output cap doing that? They all have an output cap thats fully charged, so if you have it set to 5V 0.01A to connect an LED and current limit it to 0.01A, you still have a fully charged output cap at 5V that will smoke the LED... Dont think theres anything to do about that? I blew up a fancy LED in a reps display box that way he wasnt happy hahaha
  9. Lexy has a little Mazda Premacy that is supposedly a 7 seater... but you better be a small person for the back seats though! but you all ride small bikes so should be fine? It also has a teeny tow bar for a teeny trailer (but i dont has trailer). I realistically wont do anything to the scoot as too much other shit to spend time and money on... but keen to potentially partake in shenanigans somehow. Plus @sentra will break down on day 1 and we can have a 2 day vengaboys sing along party! So don't rely on me as support vehicle, but when push comes to shove, i can 100% be bullied into attending
  10. Ned

    WAGNATS 2020 - Feb 6 - 9

    ok, you twisted my arm, i will be there
  11. Ned

    Unclejake's 64 Fintail Mercedes

    one day.... one day....
  12. Ned

    Arduino stuff/ programing/so cheap

    how is it wired up? Looks like there is a connection on the rectifier not being used??
  13. Ned

    Arduino stuff/ programing/so cheap

    i told you to throw that diode in the bin Peter... you better not put that in... you could solder wires with glue lined heat shrink to the cap, cable tie them to the cab as strain relief. Then crimp spade terminals to the wires to go to the bridge rectifier? Bolt the bridge rectifier to something metal as a heat sink? A bit of water will be fine, as long as it's not submerged. You could put some dielectric grease on the connections if you're worried about water
  14. I'm glad youre keeping the dream alive Ben!!!
  15. probably needs a lot of things TBH... might not be a bad idea to pull it apart and give it all a once over one day haha