Hello, I am new to Arduino programming, spend my life to electronics, I am 65, but not this, try different things for the last months but no luck, maybe someone can help me. I can post the last code I try'd.
Thank you
#include <Keypad.h>
#include <Adafruit_MCP4725.h>
#define MCP4725_ADDR 0x60
Adafruit_MCP4725 dac;
//number of rows on the keypad
//number of columns on the keypad
const byte numRows= 8;
const byte numCols= 5;
//Code that shows the keypad connections to the arduino terminals
byte colPins[numCols] = {10, 11, 12, A0, A1}; //Collums 0 tot 4
byte rowPins[numRows]= { 9, 8, 7, 6, 5, 4, 3, 2}; //Rows 0 tot 7
//keymap defines the key pressed according to the row and columns just as appears on the keypad
uint16_t keymap[numRows][numCols]=
{
68, 614, 1161, 1707, 2253,
137, 683, 1229, 1775, 2321,
205, 751, 1297, 1843, 2389,
273, 819, 1365, 1911, 2458,
341, 887, 1434, 1978, 2526,
410, 956, 1502, 2048,
478, 1024, 1570, 2116,
};
//initializes an instance of the Keypad class
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
void setup()
{
// initialize the serial communication:
Serial.begin(115200);
Wire.begin();
dac.begin(0x60);
}
void loop()
{
uint16_t KeyPadNum = myKeypad.getKey();
if (KeyPadNum != NO_KEY)
{
// Serial.println(KeyPadNum);
Serial.println(KeyPadNum);
Wire.beginTransmission (MCP4725_ADDR);
Wire.write(64);
//output to DAC 0-4096
dac.setVoltage(KeyPadNum, false);
}
}