5 #include <linux/i2c-dev.h> 22 #define PCF8591_I2C_ADDR 0x48 56 int main(
int argc,
char *argv[])
63 unsigned char value[4];
77 printw(
"PCF8591 + or - to change aout, any other key to quit.");
79 mvaddstr(10, 0,
"Brightness");
80 mvaddstr(12, 0,
"Temperature");
82 mvaddstr(16, 0,
"Resistor");
96 command[0] = 0x40 | ((i + 1) & 0x03);
105 sprintf(str,
"%3d", value[i]);
106 mvaddstr(10+i+i, 12, str);
107 value[i] = value[i] / 4;
108 move(10 + i + i, 16);
110 for(j = 0; j < 64; j++)
111 if(j < value[i]) addch(
'*');
else addch(
' ');
118 if ((key ==
'+') || (key ==
'=')) aout++;
119 else if ((key ==
'-') || (key ==
'_')) aout--;
120 else if (key != -1)
break;
int i2cWriteDevice(unsigned handle, char *buf, unsigned count)
ROSLIB_DECL std::string command(const std::string &cmd)
int i2cClose(unsigned handle)
int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)
int main(int argc, char *argv[])
int i2cReadByte(unsigned handle)