Most sketches don't work

Hello, I have been a member for a while but I think this is my first post so I apologize if this question has been asked and answered before but I have not been able to find it.

First let me say that I have playing with Arduino's (off and on) for over a year. I am not new to these and I am not a pro at using these but I do understand about and how to install libraries.

Why when I download most sketches for any of my Arduino boards (originals, clones or copies) I get a message that I can not download to that specific board even if I click on the correct board or if I click on every board in the list.

Also why does most every available sketch out there not work, I keep getting all kinds of error messages, sometimes as many as 20 error messages. Am I the only one out there who does not know how to write a sketch. I have seen some great code and projects out there that I would love to be able to duplicate but over 95% of the sketches I have tried are full of errors and I am incapable of learning how to write this stuff. I have literally wasted hundreds of hours downloading and failing.

Am I doing something wrong or is everyone else out there doing something wrong?

Just for the record I am using the Arduino ide 1.6.13

Any help or helpful comments would be greatly appreciated because I am getting a little tired of wasting a lot of time and money just to have nothing work.

Thank you
Jim

I have never experienced anything like that without very solid reason, despite the fact that I always order the cheapest offer on Aliexpress and mainly work on ESP8266, which is not the usually expected ATMEGA micro controller.

Without an error message, nobody can do anything for you. Concentrate on one example, post proper error messages and I am sure the probelm will be resolved fast.

The only simple thing I could think of is that you did not install libraries properly.

Sorry you've been having such a hard time. My experience is a bit different though - mostly downloaded sketches compile OK for me.

This makes me think: perhaps there's something specific to your setup that's giving you all the grief.

Let's work though an example of a sketch that's giving you trouble - maybe we can fix it.

What's the last sketch that you downloaded that gave you trouble?
Do sketches ever work?
How about the examples built-in to the IDE?

cheers

J

Are you using an R3 Uno/Mega/whatever?

I have had some sketches work like test programs for the OLED displays, some sketches for the DHT22 temp sensors, and a great clock sketch that I got from a wonderful man on ebay that I bought a display from.

So where are you finding these problem sketches?

Can you show us an example of a problematic one?

Code works if you write it properly. If you want to know why you got certain errors then post the code and the error messages here and we'll try to help you. But there is simply nothing that anyone can do for you without being able to see what the problem is.

I an using mostly ebay Arduino Uno and pro mini clones but the sketches that do work on one Uno clone also works on my other Uno clones.

I will try to download a sketch and get you some specific info. I know without that info it is hard to diagnose a problem. I will get back to you in a few minutes.

Apparently I have exceeded my allotment of posts for 5 minutes, I will get back to you whenever it lets me.

sorry the first couple of sketches were over the page allowable limit of 9000 characters.
give me a few moments to find a smaller sketch.

Also I do not write my own code I am incapable of learning it I think.

Robotjam:
I am incapable of learning it I think.

Now there's a can do attitude! Go get 'em Tiger!

Someone who doesn't understand how to write code shouldn't have code that exceeds the character limit to post. I mean, no wonder it doesn't work. You don't understand what you have and have already convinced yourself that you can't. You either need to get over that "can't" thing or sell off your Arduino gear and find a new hobby.

You can attach bigger sketches to a post; if you have to dowliad from the web, you can give us the url.

You can copy errors to textfile and attach that.

Sorry gentlemen but I just got some company and I am not able to continue this conversation at this time.

I will get back to you as soon as possible. Thanks for your help so far and again I apologize.

Jim

Sound like he's missing libraries, but it's impossible to say.

OP: pick one sketch - the shortest one that doesn't work - and post it here along with your error messages.

For the record earlier the code with more than 9000 characters was actually a lot smaller, it was the error codes that broke the limit, I had the “Show verbose output during compilation” option enabled.

Also allow me to be a little more clear on one more point. I have no idea how to write a sketch, I have tried to teach myself but I am unable to pick it up. I can however make small changes in some sketches but I am just not smart enough to write my own.

Enclosed is just one example of what I am asking about.
The error codes are at the bottom.

#include <dht.h>

//
// FILE: dht22_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.03
// PURPOSE: DHT library test sketch for DHT22 && Arduino
// URL:
// HISTORY:
// 0.1.03 extended stats for all errors
// 0.1.02 added counters for error-regression testing.
// 0.1.01
// 0.1.00 initial version
//
// Released to the public domain
//

#include <dht.h>

dht DHT;

#define DHT22_PIN 5

struct
{
uint32_t total;
uint32_t ok;
uint32_t crc_error;
uint32_t time_out;
uint32_t connect;
uint32_t ack_l;
uint32_t ack_h;
uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};

void setup()
{
Serial.begin(115200);
Serial.println(“dht22_test.ino”);
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
Serial.println();
Serial.println(“Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)”);
}

void loop()
{
// READ DATA
Serial.print(“DHT22, \t”);

uint32_t start = micros();
int chk = DHT.read22(DHT22_PIN);
uint32_t stop = micros();

stat.total++;
switch (chk)
{
case DHTLIB_OK:
stat.ok++;
Serial.print(“OK,\t”);
break;
case DHTLIB_ERROR_CHECKSUM:
stat.crc_error++;
Serial.print(“Checksum error,\t”);
break;
case DHTLIB_ERROR_TIMEOUT:
stat.time_out++;
Serial.print(“Time out error,\t”);
break;
case DHTLIB_ERROR_CONNECT:
stat.connect++;
Serial.print(“Connect error,\t”);
break;
case DHTLIB_ERROR_ACK_L:
stat.ack_l++;
Serial.print(“Ack Low error,\t”);
break;
case DHTLIB_ERROR_ACK_H:
stat.ack_h++;
Serial.print(“Ack High error,\t”);
break;
default:
stat.unknown++;
Serial.print(“Unknown error,\t”);
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(",\t");
Serial.print(DHT.temperature, 1);
Serial.print(",\t");
Serial.print(stop - start);
Serial.println();

if (stat.total % 20 == 0)
{
Serial.println("\nTOT\tOK\tCRC\tTO\tUNK");
Serial.print(stat.total);
Serial.print("\t");
Serial.print(stat.ok);
Serial.print("\t");
Serial.print(stat.crc_error);
Serial.print("\t");
Serial.print(stat.time_out);
Serial.print("\t");
Serial.print(stat.connect);
Serial.print("\t");
Serial.print(stat.ack_l);
Serial.print("\t");
Serial.print(stat.ack_h);
Serial.print("\t");
Serial.print(stat.unknown);
Serial.println("\n");
}
delay(2000);
}
//
// END OF FILE
/

Arduino: 1.6.13 (Windows 10), Board: “Arduino/Genuino Uno”

C:\Users\Jim\AppData\Local\Temp\arduino_modified_sketch_369969\sketch_jan06a.ino:17:18: fatal error: dht.h: No such file or directory

#include <dht.h>

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

I forgot to add the GitHub web address I copied it from,

C:\Users\Jim\AppData\Local\Temp\arduino_modified_sketch_369969\sketch_jan06a.ino:17:18: fatal error: dht.h: No such file or directory

 #include <dht.h>

[/code]

Well there’s not much ambiguity about that error message is there? Have you installed the dht library? Where is dht.h located on your machine?

Robotjam:
but I am just not smart enough

Real “can do” attitude there.

C:\Users\Jim\Documents\Arduino\libraries\dht_sensor_library

there are no Arduino files of any kind in C:\Users\Jim\AppData\Local\Temp\arduino_modified_sketch_369969\sketch_jan06a.ino:17:18: fatal error: dht.h: No such file or directory

Robotjam:
there are no Arduino files of any kind in C:\Users\Jim\AppData\Local\Temp\arduino_modified_sketch_369969\sketch_jan06a.ino:17:18: fatal error: dht.h: No such file or directory

The directory for 'DHT' (within the directory called 'libraries') should be called 'DHT. And inside the 'DHT' directory should contain files like DHT.cpp and DHT.h

Change your directory that is currently called 'dht_sensor_library' to 'DHT', and make sure the files inside your newly named 'DHT' directory are called DHT.cpp, DHT.h etc.

I can understand your side of things. I had similar issues when I first started, as I didn't understand the little rules. I'm sure there's some tutorials out there that show the most important things about setting up the software called 'Arduino Sketch'. There are some things that aren't obvious until we eventually get around to finding out how to work it properly. But, after a while, you find out how to work it, and should be ok after that.

Ok have renamed that file and it does have the two files you suggest already in it, but when I try to compile it I still get the same error message. I know some of these programs are sticklers for details could the problem (in this case) be the sketch is calling for #include <dht.h> and when I click on insert sketch it inserts
#include <DHT.h>

Sometimes it takes me a while to learn something, it took me almost a year to program my LED pixel light show for Christmas, but now, except for any kind of imagination, I can program it in minutes.

Is there a site out there that has “Arduino coding for dummies” because I would not want to bother you fine people every time I have a problem.

also where is this forum located I have noticed a 5 hour difference in time when I click the post button.