Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of digipot by
Diff: digipot.cpp
- Revision:
- 2:520eb3d16c18
- Parent:
- 1:0b0025664bb7
--- a/digipot.cpp Fri Apr 03 20:29:42 2015 +0000
+++ b/digipot.cpp Fri Apr 10 19:20:24 2015 +0000
@@ -2,11 +2,11 @@
#include "mbed.h"
-static int id = 0x04; //Module CAN ID, to be assigned by keypad team.
+static int id = 0x02; //Module CAN ID, to be assigned by keypad team.
static double input_amp = 3.3; //input analog signal is 3.3V
-static double R1 = 9.84; //Opamp resistor between inverting-input and ground
-static double R2 = 5.47; //Opamp resistor between output and inverting-input
+static double R1 = 9.80; //Opamp resistor between inverting-input and ground
+static double R2 = 5.49; //Opamp resistor between output and inverting-input
static double gain = 1 + R2/R1; //Non-inverting opamp gain
//Debugging Variables
@@ -35,6 +35,8 @@
spi.write(0x11); // Write data command, potentiometer zero
spi.write(wiper); // Writes wiper value
+ printf("Wiper Value = %d \n",wiper);
+
CS=1; // Selects the digipot, and executes command
}
@@ -52,7 +54,7 @@
int main()
{
- ticker.attach(&send,10); //Debugging: Changes output amplitude every 10 seconds
+ ticker.attach(&send,5); //Debugging: Changes output amplitude every 3 seconds
int OutputAmp = 0; //Default output amplitude value
digipot(OutputAmp);
