Skip to content

mcp 3462 with Arduino Zero definition-question not issue! #16

@beyondblood

Description

@beyondblood

Not really an issue, more of a question so apologies...

I'm attempting to read from channel 0 in mux mode but having issues even entering the setup and loop sections. I'm assuming it's something to do with my mcp definition since I've tested the println function and it seems to work. I'm using an Arduino Zero which is SAMD21. I added a lot of print statements to try and figure out where the program is/isn't making it to. If I go by these statements, the setup and loop aren't being read. Assuming that I've done something really dumb since I'm quite new to this.

MCP3462 mcp(10); //the problem?

void setup() {
Serial.begin(115200);
while (!Serial)
;
Serial.println(FILE);
if (!mcp.begin()) {
Serial.println("failed to initialize MCP");
while (1)
;
}
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on default analog channel:
int32_t adcdata = mcp.analogRead(MCP_CH0);

// Convert the analog reading
double voltage = adcdata * mcp.getReference() / mcp.getMaxValue();
Serial.println("converted voltage");

// print out the value you read:
Serial.println("voltage: ");
Serial.print(voltage, 10);
Serial.println("printed voltage");

// pause program for one second
delay(1000);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions