pbuk said:
Look, here is the whole of the initialization block for an
audio spectrum analyser project (the whole thing is only 116 SLOC):
Here is your example program.
#include <arduinoFFT.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define SAMPLES 64 //Must be a power of 2
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW // Set display type so that MD_MAX72xx library treets it properly
#defineQ MAX_DEVICES 4 // Total number display modules
#define CLK_PIN 13 // Clock pin to communicate with display
Don't you need to know how many CLK PIN available and can be used?
#define DATA_PIN 11 // Data pin to communicate with display
Don't you need to know how many DATA PIN available and can be used?
#define CS_PIN 10 // Control pin to communicate with display
Don't you need to know how many CS_PIN available and can be used?
#define xres 32 // Total number of columns in the display, must be <= SAMPLES/2
#define yres 8 // Total number of rows in the display
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); // display object
arduinoFFT FFT = arduinoFFT(); // FFT object
void setup() {
ADCSRA = 0b11100101; // set ADC to free running mode and set pre-scalar to 32 (0xe5)
Don't you need to know what register ADCSRA is?
ADMUX = 0b00000000; // use pin A0 and external voltage ref
Don't you need to know what register ADMUX is?
pinMode(buttonPin, INPUT);
mx.begin(); // initialize display
delay(50); // wait to get reference voltage stabilized
}
Even with this short program, seems to me you need to know the MPU more to program like what I wrote in
BLUE? meaning reading the datasheet and look at all the control registers, port pins available, dedicated inputs and outputs. Am I really doing unnecessary work looking into details?
Thanks