I'm curious if there is a Version 2 issue afoot.
Maybe give this a go with a "non-2" version (of the IDE).
I tried version 1.8.19, and got the same jagmkII error messages as before.
Quick update: the plain Arduino Nano came in the mail yesterday.
To test it, I figured I better strip the code down and build it up from there.
So, I first wired the Uno up like this:
After that I uploaded this code, using the LED_BUILTIN and the HALL sensor as INPUT_PULLUP, like some of you suggested above.
int HALL = 2;
void setup() {
// put your setup code here, to run once:
pinMode(HALL, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int Hallsensor = digitalRead(HALL);
Serial.println(Hallsensor);
if(Hallsensor == LOW){
digitalWrite(LED_BUILTIN, HIGH);
}
if(Hallsensor == HIGH){
digitalWrite(LED_BUILTIN, LOW);
}
}
Uploaded it to the Uno, and it works as expected: the built in LED lights up when I get a magnet close to the hall sensor.
Great. Let's upload it to the new, plain Arduino Nano. Exact same code, exact same wiring, exact same hall sensor (moved it over from the Uno), same everything...
Right from the start, the built in LED lights up, without me holding a magnet near the hall sensor. Stange...
Maybe I broke the hall sensor, so I built this to check that. Seems to work allright, when a magnet is close to the sensor, the LED lights up.

With the hall sensor out of the circuit connected to the Nano, I just manually connected pin 2 (yellow wire in the first picture of this post) to ground with a wire, disconnect from ground, connect, disconnect, etc, trying to make the LED blink, however the LED just stayed on.
So, I moved the yellow wire over to pin 3. Updated the code, tried again, and there we go. Now the new, plain Nano works. Why it doesn't work with pin 2, I don't know, I mean, it's the same chip as the Uno as far as I know.
But anyway, I moved over to my next test program. Now with the interrupt on pin 3 (the internet said that pin 2 and 3 are can be used for interrupts). This works as well. Finally getting somewhere, got a feeling that my tachometer was finally going to work with this new Nano
.
int HALL = 3;
volatile byte Magnetdetected = 0;
void setup() {
// put your setup code here, to run once:
pinMode(HALL, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Serial.begin(9600);
attachInterrupt(digitalPinToInterrupt(HALL), blink, RISING); // Enable interruption HALL-pin when going from LOW to HIGH.
}
void loop() {
// put your main code here, to run repeatedly:
if(Magnetdetected == 1){
digitalWrite(LED_BUILTIN, HIGH);
delay(50);
digitalWrite(LED_BUILTIN, LOW);
Magnetdetected = 0;
}
if(Magnetdetected == 0){
digitalWrite(LED_BUILTIN, LOW);
}
}
void blink(){
Magnetdetected = 1;
}
After that I visually checked the soldering connections, and proceeded to upload the full code, but without the servo wired to the Arduino Nano. Checked the serial monitor, which looked fine: the RPMs of my cordless drill were showing up and everything seemed to work allright...
It did work for over half an hour without any problems actually, untill all of a sudden I heard a stange sound and saw some smoke coming from the left side of the mini USB connector. Seriously?
Together with some strong language I quickly pulled the USB cable out of my laptop. While doing that, I saw that my laptop had already cut power to the USB port: it showed a message on the screen with a warning sign next to it. Didn't know that that kind of protection is built in, but glad it has it and that the USB ports is still functioning properly.
After this quite stressfull moment, I checked all the solder connections on the Nano for the second time, measured the resistance between the gounds and the +5V, but could not find anything with low resistance. Then I had a look at the mini USB port on the Nano, which also didn't look very toasty to me at all.
I've now just put everything in a carboard box and stored it away in a place out of sight.
I'm calling it done. For now at least. Spent too much time on it already, and every time it seems to work properly, it just randomly throws up another problem which I cannot relate to the thing I'm doing. Watching tutorials on internet, making a tachometer seems to be on of the more simple things you can do, but I still find it quite hard.
I may be doing something wrong, without knowing, but I haven't touched that USB port at all. And if it indeed shorted out, how can that happen so suddently, why did it work for more than half an hour without problems?
The USB cable was and is also just fine I guess, it still charges up or copies files over from other devices just like it should.
Anyway, I'll step away from this for a while. I'm not in the mood right now to buy another Nano and try again. Thanks a lot to everyone who helped, I certainly learned something.
I know that you have been working on this for a long and I sorry that you are having so many problems. my sympathies.
