Help with code for NanoATMega328 / 2 x DC Motors / 9g Micro Servo / HCSR04 Ultrasonic Detector

**Hi again,

You might not**
Hi again,

You might not want to use pin 3 as a PWM pin because pins 2 and 3 are your only external interrupt pins and you’ll need them for the wheel encoders at the very least.

Not using a 9v battery,

Not using a 9v battery, that’s just there in the schematic to show a power source.

I changed the code to omit the servo and made some amendments to loo left and right by turning, the motors where working ok this morning when I tested it and now when I tried to upload some new code my Mac crashed (powered off for some reason) and now the Nano is not recognised, although the power light is on, the Serial Port has disappeared??

Somethings gone wrong somewhere :frowning:

 

Yes, I believed you
Yes, I believed you mentioned a nine volt 500 am mains transformer.

500 ma is not enough to power both motors, a servo, and your Arduino. It’s as bad as a 9v smoke detector battery.

I don’t know anything about any Mac younger than twenty years old. I’m hoping somebody here can help you. My generic Windows computer advice would be to uninstall the Arduino software and the serial port driver (if you had to install one for the Arduino), then reinstall the Aarduino software.

However, that’s Voodoo debugging. The last time I was asked to fix a Mac, I picked it up a few inches and let it drop to the desk. It booted. Then I told him never to turn the machine off again. :slight_smile:

Popped in a spare Nano,

Popped in a spare Nano, uploaded my amended code re-arranged the control pins and software to match and I have a working (needs refining) bot.

Took a video but its not verry pretty so I’ll not embarrass myself :-)