cjdelphi

after trial and error (literally) of about 4 hours (I'm a pascal coder, it's hard to completely change mindset) managed to nail out a small routine that did what i need but i can't help but feel there's a much shorter version that could be written to replace this one....

String s = String(Val);Wasteful. Create in instance of the String class using the value in Val. Then, invoke the copy constructor to transfer the data the the new instance of the String class called s. Then, call the String destructor to get rid on the object on the right.

Alternatively, you could divide Val by 10 (to get 1002) and use Val %10 (to get 3), and create 2 strings ("1002" and "3") and concatenate them with a "." between them.

Even better, though, would be to ditch the String class and use a char array. Use the itoa() function to convert the value to a string. copy the last character, replace the last character with the '.', and put the last character where the NULL was, and add a new NULL on the end.

cjdelphi

Well anyway ... after some more calibration, finished, this is in C, sorry to the people who get confused by C, 0 = water freezes 100c = boils at sea level, 30c is perfect.

http://110.175.97.110:1234/

80's already use on my machine by orb, so no naughty business lol.... but yes, i bought a barometer and thought id have go, soldered on the header pins and finallygot it displaying the correct info...

also the pressure is higher on the inside of the house than it is on the out, if i opened all the doors and windows to equalize the pressure would that not drop the pressure reading?... anyway 3am tired.

cjdelphi

lol, that's what I love programming with Arduino, even with my computer off (when any of my old apps would now be 'off', the Arduino keeps on kicking via USB power) and people obviouslyget to see any bug i introduce in real time via a live url which dumps out my raw data..

I'll may as well continue, the problem i'm having is with a Barometer Sensor, many many MANY examples out there and all giving different results, so i'm not sure which one's working... and when it comes to the altitude/millibar reading, I simply took the reading I got eg 22000 and deducted what mr weatherman said the real pressure was, i'm actually at 180m above see level so that's my target number, the hpa, is 20out (not bad so it's at least working) and the altitude i have no idea...

The bluetooth code was just a small experiment of mine to remotely switch my computer on and off (I removed the push button and wired it up to pin 8 on the Arduino and fed it to a transistor, which then has the ability to forcefully turn it off (if windows hangs) and shut it down gently, soft power off via a button press longer than 4000ms.... i use 50ms for a quick press, works wonderfully, i now use it to restart my server on my pc if it hangs or if the power goes out..... (I also had this working for internet, but figured with the simple checking of each byte it receives, not a good idea as a simple /GET request would shut down the pc if someone stumbled across the IP address and port.

So anyway i'm now comparing the PDF against the code to fine tune it...

dhunt

after trial and error (literally) of about 4 hours (I'm a pascal coder, it's hard to completely change mindset) managed to nail out a small routine that did what i need but i can't help but feel there's a much shorter version that could be written to replace this one....