REPALphilread / ReP_AL-3D-Lawn-Mower

Code and Other for the ReP_AL Lawn Mower
104 stars 53 forks source link

Is Nano board really necessary inside robot? #6

Open eimix opened 5 years ago

eimix commented 5 years ago

In library adcman/adcman.h is written: "- WARNING: never use any 'analogRead()' in your code when using this class!"

This warning prevents using standard arduino functions, but it provides it's own functionality. Analog inputs could be read using this library:

Setup ADC pin: ADCMan.setCapture(pinMotorMowSense, 1, 1); Program loop:
ADCMan.run(); if (ADCMan.isCaptureComplete(pinMotorMowSense)){ int value = ADCMan.read(pinMotorMowSense); }

Is there any other limitation that makes Nano board necessary?

lucabiasotto commented 3 years ago

I asked myself the same question. I removed the nano and directly used ADC to read volts and amps, it's works!!!

comperta commented 3 years ago

@lucabiasotto do not hesitate to share your modifications with us :-)

lucabiasotto commented 3 years ago

Hi @comperta, i connect the volt sensor to the A2 pin of the mega, then:

  1. On Setup_ADCMan method add the following command before ADCMan.run() :

ADCMan.setCapture(A2, 1, false);

  1. Comment the code where you read RawValueVolt from nano.

  2. finally you can use RawValueVolt = ADCMan.read(A2) for get the volt value.

I have a question for you, I don't understand what is the advantage of using ADCMan library. Do you think we could do everything with analogRead? Thanks :)