mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-12-27 03:17:06 -07:00
add ADC stuff
This commit is contained in:
parent
b51d5b5b6f
commit
e192c2d429
|
@ -5,6 +5,7 @@ verify_ssl = true
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
pylint = "*"
|
pylint = "*"
|
||||||
|
ipykernel = "*"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
numpy = "*"
|
numpy = "*"
|
||||||
|
@ -12,6 +13,7 @@ matplotlib = "*"
|
||||||
scipy = "*"
|
scipy = "*"
|
||||||
adafruit-circuitpython-servokit = "*"
|
adafruit-circuitpython-servokit = "*"
|
||||||
adafruit-circuitpython-ads1x15 = "*"
|
adafruit-circuitpython-ads1x15 = "*"
|
||||||
|
adafruit-blinka = "*"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.6"
|
python_version = "3.6"
|
||||||
|
|
169
Software/python/Pipfile.lock
generated
169
Software/python/Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "b602071939b8a8f86526a542668eea93da90e3162fcda91e38eb292e737593f7"
|
"sha256": "c325e5b1e34aed96d35c0501b5bae87e4afbdb9013334882dfbaf94b6460fa46"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:977e8601790e7252ca29967c8e9ff2627f1b8290dad4343dfd5b697905ad7d3e"
|
"sha256:977e8601790e7252ca29967c8e9ff2627f1b8290dad4343dfd5b697905ad7d3e"
|
||||||
],
|
],
|
||||||
|
"index": "pypi",
|
||||||
"version": "==4.1.0"
|
"version": "==4.1.0"
|
||||||
},
|
},
|
||||||
"adafruit-circuitpython-ads1x15": {
|
"adafruit-circuitpython-ads1x15": {
|
||||||
|
@ -258,6 +259,42 @@
|
||||||
],
|
],
|
||||||
"version": "==2.3.3"
|
"version": "==2.3.3"
|
||||||
},
|
},
|
||||||
|
"backcall": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4",
|
||||||
|
"sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2"
|
||||||
|
],
|
||||||
|
"version": "==0.1.0"
|
||||||
|
},
|
||||||
|
"decorator": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760",
|
||||||
|
"sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"
|
||||||
|
],
|
||||||
|
"version": "==4.4.2"
|
||||||
|
},
|
||||||
|
"ipykernel": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:7f1f01df22f1229c8879501057877ccaf92a3b01c1d00db708aad5003e5f9238",
|
||||||
|
"sha256:ba8c9e5561f3223fb47ce06ad7925cb9444337ac367341c0c520ffb68ea6d120"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==5.1.4"
|
||||||
|
},
|
||||||
|
"ipython": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:ca478e52ae1f88da0102360e57e528b92f3ae4316aabac80a2cd7f7ab2efb48a",
|
||||||
|
"sha256:eb8d075de37f678424527b5ef6ea23f7b80240ca031c2dd6de5879d687a65333"
|
||||||
|
],
|
||||||
|
"version": "==7.13.0"
|
||||||
|
},
|
||||||
|
"ipython-genutils": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8",
|
||||||
|
"sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"
|
||||||
|
],
|
||||||
|
"version": "==0.2.0"
|
||||||
|
},
|
||||||
"isort": {
|
"isort": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1",
|
"sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1",
|
||||||
|
@ -265,6 +302,27 @@
|
||||||
],
|
],
|
||||||
"version": "==4.3.21"
|
"version": "==4.3.21"
|
||||||
},
|
},
|
||||||
|
"jedi": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:b4f4052551025c6b0b0b193b29a6ff7bdb74c52450631206c262aef9f7159ad2",
|
||||||
|
"sha256:d5c871cb9360b414f981e7072c52c33258d598305280fef91c6cae34739d65d5"
|
||||||
|
],
|
||||||
|
"version": "==0.16.0"
|
||||||
|
},
|
||||||
|
"jupyter-client": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:1fac6e3be1e797aea33d5cd1cfa568ff1ee71e01180bc89f64b24ee274f1f126",
|
||||||
|
"sha256:ed2490c65f7e0987d1e7b2c4146371d58112489e558b3a835aefb86b7283f930"
|
||||||
|
],
|
||||||
|
"version": "==6.0.0"
|
||||||
|
},
|
||||||
|
"jupyter-core": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:394fd5dd787e7c8861741880bdf8a00ce39f95de5d18e579c74b882522219e7e",
|
||||||
|
"sha256:a4ee613c060fe5697d913416fc9d553599c05e4492d58fac1192c9a6844abb21"
|
||||||
|
],
|
||||||
|
"version": "==4.6.3"
|
||||||
|
},
|
||||||
"lazy-object-proxy": {
|
"lazy-object-proxy": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d",
|
"sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d",
|
||||||
|
@ -298,6 +356,49 @@
|
||||||
],
|
],
|
||||||
"version": "==0.6.1"
|
"version": "==0.6.1"
|
||||||
},
|
},
|
||||||
|
"parso": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0c5659e0c6eba20636f99a04f469798dca8da279645ce5c387315b2c23912157",
|
||||||
|
"sha256:8515fc12cfca6ee3aa59138741fc5624d62340c97e401c74875769948d4f2995"
|
||||||
|
],
|
||||||
|
"version": "==0.6.2"
|
||||||
|
},
|
||||||
|
"pexpect": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937",
|
||||||
|
"sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"
|
||||||
|
],
|
||||||
|
"markers": "sys_platform != 'win32'",
|
||||||
|
"version": "==4.8.0"
|
||||||
|
},
|
||||||
|
"pickleshare": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca",
|
||||||
|
"sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"
|
||||||
|
],
|
||||||
|
"version": "==0.7.5"
|
||||||
|
},
|
||||||
|
"prompt-toolkit": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:a402e9bf468b63314e37460b68ba68243d55b2f8c4d0192f85a019af3945050e",
|
||||||
|
"sha256:c93e53af97f630f12f5f62a3274e79527936ed466f038953dfa379d4941f651a"
|
||||||
|
],
|
||||||
|
"version": "==3.0.3"
|
||||||
|
},
|
||||||
|
"ptyprocess": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0",
|
||||||
|
"sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f"
|
||||||
|
],
|
||||||
|
"version": "==0.6.0"
|
||||||
|
},
|
||||||
|
"pygments": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b",
|
||||||
|
"sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe"
|
||||||
|
],
|
||||||
|
"version": "==2.5.2"
|
||||||
|
},
|
||||||
"pylint": {
|
"pylint": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:3db5468ad013380e987410a8d6956226963aed94ecb5f9d3a28acca6d9ac36cd",
|
"sha256:3db5468ad013380e987410a8d6956226963aed94ecb5f9d3a28acca6d9ac36cd",
|
||||||
|
@ -306,6 +407,46 @@
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.4.4"
|
"version": "==2.4.4"
|
||||||
},
|
},
|
||||||
|
"python-dateutil": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
|
||||||
|
"sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
|
||||||
|
],
|
||||||
|
"version": "==2.8.1"
|
||||||
|
},
|
||||||
|
"pyzmq": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0bbc1728fe4314b4ca46249c33873a390559edac7c217ec7001b5e0c34a8fb7f",
|
||||||
|
"sha256:1e076ad5bd3638a18c376544d32e0af986ca10d43d4ce5a5d889a8649f0d0a3d",
|
||||||
|
"sha256:242d949eb6b10197cda1d1cec377deab1d5324983d77e0d0bf9dc5eb6d71a6b4",
|
||||||
|
"sha256:26f4ae420977d2a8792d7c2d7bda43128b037b5eeb21c81951a94054ad8b8843",
|
||||||
|
"sha256:32234c21c5e0a767c754181c8112092b3ddd2e2a36c3f76fc231ced817aeee47",
|
||||||
|
"sha256:3f12ce1e9cc9c31497bd82b207e8e86ccda9eebd8c9f95053aae46d15ccd2196",
|
||||||
|
"sha256:4557d5e036e6d85715b4b9fdb482081398da1d43dc580d03db642b91605b409f",
|
||||||
|
"sha256:4f562dab21c03c7aa061f63b147a595dbe1006bf4f03213272fc9f7d5baec791",
|
||||||
|
"sha256:5e071b834051e9ecb224915398f474bfad802c2fff883f118ff5363ca4ae3edf",
|
||||||
|
"sha256:5e1f65e576ab07aed83f444e201d86deb01cd27dcf3f37c727bc8729246a60a8",
|
||||||
|
"sha256:5f10a31f288bf055be76c57710807a8f0efdb2b82be6c2a2b8f9a61f33a40cea",
|
||||||
|
"sha256:6aaaf90b420dc40d9a0e1996b82c6a0ff91d9680bebe2135e67c9e6d197c0a53",
|
||||||
|
"sha256:75238d3c16cab96947705d5709187a49ebb844f54354cdf0814d195dd4c045de",
|
||||||
|
"sha256:7f7e7b24b1d392bb5947ba91c981e7d1a43293113642e0d8870706c8e70cdc71",
|
||||||
|
"sha256:84b91153102c4bcf5d0f57d1a66a0f03c31e9e6525a5f656f52fc615a675c748",
|
||||||
|
"sha256:944f6bb5c63140d76494467444fd92bebd8674236837480a3c75b01fe17df1ab",
|
||||||
|
"sha256:a1f957c20c9f51d43903881399b078cddcf710d34a2950e88bce4e494dcaa4d1",
|
||||||
|
"sha256:a49fd42a29c1cc1aa9f461c5f2f5e0303adba7c945138b35ee7f4ab675b9f754",
|
||||||
|
"sha256:a99ae601b4f6917985e9bb071549e30b6f93c72f5060853e197bdc4b7d357e5f",
|
||||||
|
"sha256:ad48865a29efa8a0cecf266432ea7bc34e319954e55cf104be0319c177e6c8f5",
|
||||||
|
"sha256:b08e425cf93b4e018ab21dc8fdbc25d7d0502a23cc4fea2380010cf8cf11e462",
|
||||||
|
"sha256:bb10361293d96aa92be6261fa4d15476bca56203b3a11c62c61bd14df0ef89ba",
|
||||||
|
"sha256:bd1a769d65257a7a12e2613070ca8155ee348aa9183f2aadf1c8b8552a5510f5",
|
||||||
|
"sha256:cb3b7156ef6b1a119e68fbe3a54e0a0c40ecacc6b7838d57dd708c90b62a06dc",
|
||||||
|
"sha256:e8e4efb52ec2df8d046395ca4c84ae0056cf507b2f713ec803c65a8102d010de",
|
||||||
|
"sha256:f37c29da2a5b0c5e31e6f8aab885625ea76c807082f70b2d334d3fd573c3100a",
|
||||||
|
"sha256:f4d558bc5668d2345773a9ff8c39e2462dafcb1f6772a2e582fbced389ce527f",
|
||||||
|
"sha256:f5b6d015587a1d6f582ba03b226a9ddb1dfb09878b3be04ef48b01b7d4eb6b2a"
|
||||||
|
],
|
||||||
|
"version": "==19.0.0"
|
||||||
|
},
|
||||||
"six": {
|
"six": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a",
|
"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a",
|
||||||
|
@ -313,6 +454,25 @@
|
||||||
],
|
],
|
||||||
"version": "==1.14.0"
|
"version": "==1.14.0"
|
||||||
},
|
},
|
||||||
|
"tornado": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c",
|
||||||
|
"sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60",
|
||||||
|
"sha256:4e73ef678b1a859f0cb29e1d895526a20ea64b5ffd510a2307b5998c7df24281",
|
||||||
|
"sha256:559bce3d31484b665259f50cd94c5c28b961b09315ccd838f284687245f416e5",
|
||||||
|
"sha256:abbe53a39734ef4aba061fca54e30c6b4639d3e1f59653f0da37a0003de148c7",
|
||||||
|
"sha256:c845db36ba616912074c5b1ee897f8e0124df269468f25e4fe21fe72f6edd7a9",
|
||||||
|
"sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5"
|
||||||
|
],
|
||||||
|
"version": "==6.0.3"
|
||||||
|
},
|
||||||
|
"traitlets": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:70b4c6a1d9019d7b4f6846832288f86998aa3b9207c6821f3578a6a6a467fe44",
|
||||||
|
"sha256:d023ee369ddd2763310e4c3eae1ff649689440d4ae59d7485eb4cfbbe3e359f7"
|
||||||
|
],
|
||||||
|
"version": "==4.3.3"
|
||||||
|
},
|
||||||
"typed-ast": {
|
"typed-ast": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355",
|
"sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355",
|
||||||
|
@ -340,6 +500,13 @@
|
||||||
"markers": "implementation_name == 'cpython' and python_version < '3.8'",
|
"markers": "implementation_name == 'cpython' and python_version < '3.8'",
|
||||||
"version": "==1.4.1"
|
"version": "==1.4.1"
|
||||||
},
|
},
|
||||||
|
"wcwidth": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603",
|
||||||
|
"sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"
|
||||||
|
],
|
||||||
|
"version": "==0.1.8"
|
||||||
|
},
|
||||||
"wrapt": {
|
"wrapt": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1"
|
"sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1"
|
||||||
|
|
|
@ -1,20 +1,42 @@
|
||||||
import time
|
import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
import board
|
||||||
|
import digitalio
|
||||||
from adafruit_servokit import ServoKit
|
from adafruit_servokit import ServoKit
|
||||||
from adafruit_ads1x15 import ads1015
|
from adafruit_ads1x15.ads1015 import ADS
|
||||||
|
from adafruit_ads1x15.analog_in import AnalogIn
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
servos = ServoKit(channels=16).continuous_servo
|
mux = np.empty(4)
|
||||||
servos[0].throttle = 0
|
mux[0] = digitalio.DigitalInOut(board.D17).value
|
||||||
servos[1].throttle = 0
|
mux[1] = digitalio.DigitalInOut(board.D27).value
|
||||||
servos[2].throttle = 0
|
mux[2] = digitalio.DigitalInOut(board.D22).value
|
||||||
time.sleep(1)
|
mux[3] = digitalio.DigitalInOut(board.D23).value
|
||||||
servos[0].throttle = 20
|
|
||||||
servos[1].throttle = 20
|
adc = ADS.ADS1015()
|
||||||
servos[2].throttle = 20
|
adc_mux = AnalogIn(adc, ADS.P0)
|
||||||
time.sleep(1)
|
|
||||||
servos[0].throttle = 0
|
def get_reflectivity(chan):
|
||||||
servos[1].throttle = 0
|
chan = int(chan)
|
||||||
servos[2].throttle = 0
|
global mux
|
||||||
|
mux = np.array(list(f"{chan:04b}"), dtype=int)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
for ii in range(8):
|
||||||
|
print(get_reflectivity(ii), end="")
|
||||||
|
print()
|
||||||
|
|
||||||
|
# servos = ServoKit(channels=16).continuous_servo
|
||||||
|
# servos[0].throttle = 0
|
||||||
|
# servos[1].throttle = 0
|
||||||
|
# servos[2].throttle = 0
|
||||||
|
# time.sleep(1)
|
||||||
|
# servos[0].throttle = 20
|
||||||
|
# servos[1].throttle = 20
|
||||||
|
# servos[2].throttle = 20
|
||||||
|
# time.sleep(1)
|
||||||
|
# servos[0].throttle = 0
|
||||||
|
# servos[1].throttle = 0
|
||||||
|
# servos[2].throttle = 0
|
||||||
|
|
||||||
# adc = ads1015()
|
|
Loading…
Reference in New Issue
Block a user