Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Serial.print problems on: May 10, 2014, 10:40:04 am
Hello all

I'm struggling a bit to get a large number to compile in Serial.print. I have a value which has been declared as unsigned long long (I'm measuring a long process in milliseconds which can run for weeks). If I do Serial.print((long)value), it compiles fine. If I do Serial.print((long long)value) or Serial.print((long long unsigned)value it comes up with the "error: call of overloaded 'print(long long unsigned int)' is ambiguous". Looked for any references to this, without success. I'm using Nick Gammon's Robot Racer example , but with longer times. Essentially, I'm trying to capture a train of pulses 10mS ON 10mS OFF which might run for several hours, then not re-occur for weeks or months. If anyone has done anything similar or my formatting is wrong or it is simply not possible, I would be grateful to hear. I don't actually need to know how long the individual pulses are,  just what the duration of the train is.

2  Using Arduino / Programming Questions / Re: Entering numbers at the Serial Monitor on: April 12, 2014, 11:50:44 am
Hello Paul,
Thanks for the reply - you must be up early - it's 16:48 GMT here in UK.
I'm afraid that I'm at the stage in life where most folks prefer to do crosswords, but I'm always ready for a challenge and coping with Zigbee and Arduino plus the hardware is fairly demanding starting from zero. I'll take a look at all the things you have suggested and toInt() is a new one on me. I have to glean knowledge from wherever I can and I do make use of all the resources, but now and again you need a little guidance. I definitely WILL have a look at what reference has to say, but this is one old dog trying to learn new tricks.
Thanks again
3  Using Arduino / Programming Questions / Entering numbers at the Serial Monitor on: April 12, 2014, 10:02:04 am
Hello All,
I'm using a Uno + XBee Series 1 + LCD to mirror the reading at a gas meter - this is mainly to do with the difficulty in reading the thing where it is sited. As a real novice here, I have managed to get everything going to the point where the Hall sensor at the meter picks up each dial rotation and adds it to the LCD display in the house. To get real readings displayed, I need to input a nine digit number which is the "offset" to which the incoming pulses are added.

I was playing around with some published sketches (thank you) with the code below.

int incomingByte = 0;   // for incoming serial data
String inString = "";    // string to hold input

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
  Serial.print ("enter data at command line and check that set to NEWLINE");
  Serial.print("\n");//needs this to display "value" and "string" - if omitted, displays "string" only first time round

void loop() {
            // put your main code here, to run repeatedly:
             // send data only when you receive data:
            if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte =;
                 if (isDigit(incomingByte)) {
      // convert the incoming byte to a char
      // and add it to the string:
      inString += (char)incomingByte;
                 if (incomingByte == '\n') {
      Serial.print("String: ");
      // clear the string for new input:
      inString = "";


I have only changed some of the text messages and added one calculation (*2).

If I enter 999999999 (i.e.9 digits), everything is OK - if a tenth digit is added, it overflows.

Can someone tell me why it happens, and what is the significance of the "overflow" number that comes up on the Serial Monitor?

4  Using Arduino / Displays / Re: What distance can LCD be separated from Arduino? on: December 22, 2013, 07:18:52 am
Hello everyone,
Thanks for all the replies.
I will give it a go and report back - at least no "won't works". I am still very new to all this, but enjoying the challenges. Setting up commercial programmable room thermostats and the like are always a challenge if sited 2 feet from the floor. I like to get buttons bit away from the guts of it on as long a lead as possible. Transmission speed will not be a problem with what is going to be a very slowly changing signal. I used to work with very high impedance sources (pH electrodes) where any movement of the cables caused problems. Answer - put the amplifier on the top of the electrode and the cable and length becomes a non-issue.
5  Using Arduino / Displays / What distance can LCD be separated from Arduino? on: December 21, 2013, 11:24:12 am
Does anyone have any experience of running a standard LCD module at, say, 1 metre from the Arduino? I am putting together a thermostat where the power/Arduino/relays etc will be in a power base which will be sited away from the display and any up/down/set buttons. If feasible, any recommendations for cable? twisted? shielded? ribbon? This to avoid climbing over an electrically heated water tank to see the readings or set the temperatures. Wireless?
6  Using Arduino / Project Guidance / Re: Tide gauge and river water level sensor ideas on: July 28, 2013, 12:51:55 pm
As an ex-industrial instrumentation technologist, I can confirm that most open tanks to depths up to 4-metres would have used ultrasonic devices. These were very expensive, but very reliable (Pepperl & Fuchs for example). Calibration is complex. I tried cheaper versions, but they are prone to wildlife like spiders taking up residence. Floats and wires and pulleys are still widely used. Have a look at heating oil tank gauges - these seem to be cheap, contactless and wireless - probably ultrasonic. Triangulation with a couple of optical sensors is possible, and the reflective type which use a reflector like a bicycle mudguard have surprisingly long ranges (20-metres or more). I am about to do something for calculating the volume of a rainwater storage tank. I will be looking at a differential pressure sensor, but the mechanical methods might be in the running. Laser distance finders are remarkably accurate, but would need some means of damping the target movement. Also might be worth looking at how cheap digital vernier calipers work - I believe this is capacitive and again it is reliable and cheap - you could look at mechanical scaling down of your range to bring it into the caliper range. I do know that the environment agencies use float methods for bomb-proof river level measurements.
Good luck
7  Topics / Home Automation and Networked Objects / Re: Arduino Thermostat Project on: November 25, 2012, 10:57:21 am
Well done - this looks really interesting and just what I am looking for. I don't really have the time or ability to develop complex code, but I'm fed up with expensive gear like Honeywell programmable thermostats breaking down and having to bin because they can't be are definitley on the right tracks

retired environmental scientist
8  Community / Gigs and Collaborations / Commissions on: April 25, 2012, 09:04:12 am
Hello all,
Just wondering if any experts out there are interested in taking on a commission to do a bit of programming for me.
I have one or two projects in mind, but just don't get the free time to get to grips with all.
I would be interested in getting a board going with 3 or 4 temperature inputs (would like to use onewire DS1820) with a humidity input, with aview to getting a mains (240-VAC) fan running when at least one temperature drops below a set point and humidity goes above a set point. Other temperatures are just for monitoring. Long term aim might include data logging or local (LCD) or PC display.
9  Using Arduino / Programming Questions / Re: OneWire, again on: October 04, 2011, 10:26:32 am
Hi there,
That's what I thought, but it helps us newcomers if there was a bit of a clue where to put them.
10  Using Arduino / Programming Questions / Re: OneWire, again on: October 04, 2011, 10:14:08 am
Hello John,
Error compiling = no ref to setup or loop?
11  Using Arduino / Programming Questions / OneWire, again on: October 03, 2011, 11:40:47 am
I am a relative newcomer to Arduino, but after Blink, decided to go for OneWire as I have some potential applications for this technology.
There are many and varied examples of OneWire code out there, including examples in Arduino 0022. My problem has been to find a published sketch that works out of the box. I downloaded the DallasTemp and Onewire libraries from sites like PJRC and milesburton, and finally got some of these to work, for one device at least. After shuffling around some of these published libraries, it was a disappointment to find that the sketches that did work, suddenly didn't, and came up with errors like "OneWire does not name a type" or similar. I am coming to the conclusion that there are several versions of DallasTemp and OneWire libraries around, and if the wrong one is in the 0022 library folder, then nothing works.
Is there a universal solution to this i.e. a set of published libraries that work with all the published sketches, or is there a way of organising the libraries so that the right sketch finds the right libraries?
I want to persevere with OneWire, but at this stage I am still reluctant to mess about with library names - I know that there is version 2 of OneWire, so if I renamed this library OneWire2.h and called it as OneWire2 from the sketch. would this work?
A typical example is the OneWire Doghouse sketch from Hacktronics, which doesn't seem to work even when using their versions of DallasTemp and OneWire libraries.
Please forgive any misspellings or naivety, and at this stage, suggestions like use LM35 are not an option as I need the analogues for something else.

12  Using Arduino / Installation & Troubleshooting / Re: Brief digital high on start up on: September 19, 2011, 12:03:12 pm
Hello all,
Thanks for all the replies and help.
It does seem to be OK on board reset (10 out of 10 resets fine).
It is behaving impeccably at the moment so I will need to see what I have done in the meantime (guilty of throwing solutions at it). I will definitely look at the other threads and will implement external pull-ups - I suspect floating pins might have something to do with it.
"Forcing low" was simply digitalWrite (LOW) to start with.
Sorry Rozee - only spotted Radman's post after I pushed the post button.
Looking for perfection in an imperfect world.
13  Using Arduino / Installation & Troubleshooting / Brief digital high on start up on: September 17, 2011, 11:03:24 am
Using Decimilenove and noticed that on every start up or Serial Monitor select, the digitals briefly flash high - even does it in Blink, regardless of whether the digital is selected or not (i.e. plug an LED into pin 7 instead of 13), and that flashes as well. Tried forcing outputs low, but still get it. I haven't tried measuring duration or magnitude.

I want run some mains equipment via relay eventually, so I don't want any chattering every time I look on Serial Monitor.

It might only be a ghost transient and may disappear when pin is connected to real equipment - as all real life operations are slow (seconds, not milliseconds), could the output be "slugged" with a small capacitor?

Any ideas appreciated.
14  Using Arduino / Programming Questions / Re: Digital output goes high on power up on: September 12, 2011, 01:13:21 pm
Thanks all so far.
I think I have clue what the problem might be.
The Dallas datasheet gives 85 degrees C as a special number which is the device reset output on initial power up.
I caught this number in the serial monitor, and as I have set the digital output to go high on temperatures above 25 degrees, this why it goes high initially.
Tested this by setting my digital output to go high only on temperatures above 85 degrees, and problem solved, no digital output on power up.
Just need to find a way to keep this number out for about 5 seconds.
15  Using Arduino / Programming Questions / Re: Digital output goes high on power up on: September 12, 2011, 09:11:34 am
Thanks AWOL,
I didn't write the second quoted bit of code - that was copied from Sheepdogguides who seem to have copied it from Nuelectronics.
I tried swapping the two lines to no effect. This initial digital high is annoying rather than anything else. Should this bit of code be located somewhere else?
Pages: [1] 2