Arduino Forum

Using Arduino => Project Guidance => Topic started by: avalon66 on Apr 16, 2019, 01:04 pm

Title: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 01:04 pm
I have put this project together, and as you may see I have a half size pcb board strapped to a full sized bread board, and I've soldered a few male header pins, resistors and buttons to the pcb board.

I have checked that power is getting to each device which is attached , and there isi full continuity between various points on pcb board and breadboard.
The DS3107RTC is working and returns an address when I used the I2C scanner, and the display lights up when a 5volt 2.5 amp power supply is connected.

After I uploaded the sketch and powered up, only the display came on but no sketch running.

The code and a picture of the setup attached
Title: Re: Sketch won't run
Post by: groundFungus on Apr 16, 2019, 01:15 pm
In your picture of the setup, it looks like the humidity sensor power is connected backwards.
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 16, 2019, 01:18 pm
Quote
but no sketch running.
If the upload was successful then the sketch will be running

Put some Serial.print()s in the code at strategic points such as entry to and return from functions and print out the value of pertinent variables.  Is the code calling the functions that you expect and are the values of variables sensible ?
Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 04:50 pm
In your picture of the setup, it looks like the humidity sensor power is connected backwards.
Yes it was, and I noticed that fater I took the picture, but it is the right round now.

The display is supposed to scroll the date and time along with temperature and humidityL

https://arduino-projects-free.blogspot.com/2018/06/max7219-rtc-ds1307-dht11-led-matrix.html
Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 05:04 pm
If the upload was successful then the sketch will be running

Put some Serial.print()s in the code at strategic points such as entry to and return from functions and print out the value of pertinent variables.  Is the code calling the functions that you expect and are the values of variables sensible ?
Thanks, but first off , it is not my code but from here:

https://arduino-projects-free.blogspot.com/2018/06/max7219-rtc-ds1307-dht11-led-matrix.html

I tried this:

RTC.readTime();
  sprintf(psz, "%02d", RTC.s);
  Serial.print("Time");

But it didn't work, so I must have got it in the wrong place.

So I tried it here, but nothing printed out:
RTC.readTime();
  sprintf(psz, "%c%02d%c%02d", (f ? ':' : ' '), RTC.h, (f ? ':' : ' '), RTC.m);
  Serial.print("Time");

If you could point me to the right place please.
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 16, 2019, 05:38 pm
Quote
But it didn't work
Did you add a Serial.begin() to setup() ?
Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 06:38 pm
After I disconnected the DHT sensor and buttons from the Arduino, I uploaded the MD_Parola,/ Parola_Scrolling, but that does not show anything on the display.

And in a serial monitor it shows:
17:30:50.011 -> ⸮⸮⸮⸮⸮⸮0⸮i8E2#

This is at the top of the sketch

#if DEBUG
#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }
#define PRINTS(x) Serial.print(F(x))
#define PRINTX(x) Serial.println(x, HEX)
#else

Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 07:32 pm
Did you add a Serial.begin() to setup() ?
No I didn't as I didn't know I had to do that.
I've just added Serial.begin() now  in the void setup(void) section, but the sketch won't compile.
Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 08:46 pm
I have uploaded the Parolla_Scrolling sketch, and have just the display attached to the  arduino.

In a serial monitor this printed:
19:43:26.839 -> ⸮
19:43:28.443 -> [Parola Scrolling Display]
19:43:28.443 -> Type a message for the scrolling display
19:43:28.443 -> End message line with a newline

There is nothing on the display, except that it is lit up

So as someone said earlier the sketch is running but the display does not show anything
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 16, 2019, 10:53 pm
Quote
I've just added Serial.begin() now  in the void setup(void) section, but the sketch won't compile.
What baud rate did you specify in the the begin() function ?
Title: Re: Sketch won't run
Post by: avalon66 on Apr 16, 2019, 11:05 pm
What baud rate did you specify in the the begin() function ?
It was 57600 as specified in the said sketch
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 16, 2019, 11:19 pm
It was 57600 as specified in the said sketch
Which sketch is that ?

What error did you get ?
Title: Re: Sketch won't run
Post by: avalon66 on Apr 17, 2019, 11:28 am
Which sketch is that ?

What error did you get ?
It was the Parolla Scrolling sketch, and there was nothing on the display, as it went off.
As soon as I plug in the usb lead to the arduino, the display lights up then goes off! Is it faulty or what as I have only had it for about a week and have not been able to get the sketch to run, even tho' it lights up.
Title: Re: Sketch won't run
Post by: avalon66 on Apr 17, 2019, 06:09 pm
I have uploaded the sketch and wiring diagram.

The sketch is over 600 lines so I can't put it between code tags.
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 17, 2019, 06:27 pm
I see that there is no Serial.begin() in the sketch nor any debugging Serial.print()s

What did you try ?
Title: Re: Sketch won't run
Post by: avalon66 on Apr 17, 2019, 07:59 pm
When I put Serial.begin () under void setup(void)

I got this error
exit status 1
no matching function for call to 'HardwareSerial::begin()'

So where should I put it. Actually I did ask for you to point me to where I should put Serial.begin in another post
Title: Re: Sketch won't run
Post by: UKHeliBob on Apr 17, 2019, 08:56 pm
Quote
So where should I put it. Actually I did ask for you to point me to where I should put Serial.begin in another post
Put it in setup(), but you must specify the baud rate.

When I asked what baud rate you had used in the Serial.begin() you said, in post #10
Quote
It was 57600 as specified in the said sketch
Title: Re: Sketch won't run
Post by: avalon66 on Apr 17, 2019, 09:10 pm
So as before I uploaded the Parola_Scrolling sketch and it returned the exact same in a Serial Monitor as it did before.

The display lights up, but does not show anything at all in the display.
Title: Re: Sketch won't run
Post by: avalon66 on Apr 18, 2019, 10:37 am
I have solved the problem now, in that I am now powering the Arduino by a 9volt power supply, and the display is now working fine. The text and numbers are scrolling across the the display.

I finally realised that 5volts was never going to be enough, as there are 3 devices connected to the breadboard, which all are 5 volt devices.

Thanks