Shop OBEX P1 Docs P2 Docs Learn Events
Silly ADC problem — Parallax Forums

Silly ADC problem

AkrosAkros Posts: 1
edited 2013-11-22 07:05 in Propeller 1
Hi there,

Im just trying to follow one of the simplest code examples in the website. I use the Prop ASC+, so I need to change the parameters in the example because it uses diferent pins to read the analog input in the board.

My code is quite simple but Im not receiving any lecture. Am I missing something?


#include "simpletools.h" // Include simple tools
#include "adcDCpropab.h" // Include adcDCpropab


int main() // Main function
{

adc_init(27, 25, 23, 26); // CS=27, SCL=25, DI=26
float v0,v1,v2,v3,v4,v5; // Voltage values
while(1)
{
v0 = adc_volts(0); // Check A/D 2
v1 = adc_volts(1); // Check A/D 2
v2 = adc_volts(2); // Check A/D 2
v3 = adc_volts(3); // Check A/D 2
v4 = adc_volts(4); // Check A/D 2
v5 = adc_volts(5); // Check A/D 2
putChar(HOME); // Cursor -> top-left "home"
print("A/D0 = %f V%c\n", v0, CLREOL); // Display volts
print("A/D1 = %f V%c\n", v1, CLREOL); // Display volts
print("A/D2 = %f V%c\n", v2, CLREOL); // Display volts
print("A/D3 = %f V%c\n", v3, CLREOL); // Display volts
print("A/D4 = %f V%c\n", v4, CLREOL); // Display volts
print("A/D5 = %f V%c\n", v5, CLREOL); // Display volts
pause(100); // Wait 1/10 of a second
}
}

Comments

Sign In or Register to comment.