|
114 | 114 | "from adafruit_ads1x15.ads1x15 import Mode\n",
|
115 | 115 | "\n",
|
116 | 116 | "# Create the ADC object, for the ADS1115. \n",
|
117 |
| - "# Set Mode to continuous for higher sampling frequency\n", |
118 |
| - "ads = ADS.ADS1115(i2c, mode=Mode.CONTINUOUS)" |
| 117 | + "# Set Mode to continuous for higher sampling frequency and specify data_rate\n", |
| 118 | + "ads = ADS.ADS1115(i2c, mode=Mode.CONTINUOUS, data_rate=860)" |
119 | 119 | ]
|
120 | 120 | },
|
121 | 121 | {
|
|
187 | 187 | "import time\n",
|
188 | 188 | "\n",
|
189 | 189 | "# Create the ADC object, for the ADS1115. \n",
|
190 |
| - "# Set Mode to continuous for higher sampling frequency\n", |
191 |
| - "ads = ADS.ADS1115(i2c, mode=Mode.CONTINUOUS)\n", |
| 190 | + "# Set Mode to continuous for higher sampling frequency and specify data_rate\n", |
| 191 | + "ads = ADS.ADS1115(i2c, mode=Mode.CONTINUOUS, data_rate=860)\n", |
192 | 192 | "\n",
|
193 | 193 | "# Print the raw values and the voltage\n",
|
194 | 194 | "while True:\n",
|
|
197 | 197 | " chan = AnalogIn(ads, ADS.P0)\n",
|
198 | 198 | " value = chan.value\n",
|
199 | 199 | " voltage = chan.voltage\n",
|
200 |
| - " time.sleep(0.005)\n", |
| 200 | + " time.sleep(0.005) #adjust to alter the speed of the loop\n", |
201 | 201 | " \n",
|
202 | 202 | " print('\\r\\n Value = %4d , Voltage = %.4f '%(value,voltage))\n",
|
203 | 203 | " \n",
|
|
0 commit comments