From 70dcc87c88568ccf686ef355133f4ae5331c7bc9 Mon Sep 17 00:00:00 2001 From: nihonium Date: Mon, 21 Feb 2022 10:05:36 +0300 Subject: [PATCH] 2 --- 2/2-2-bin-number.py | 37 +++++++++++++++++++++++++++++++++++++ 2/data.txt | 4 ++++ 2 files changed, 41 insertions(+) create mode 100644 2/2-2-bin-number.py create mode 100644 2/data.txt diff --git a/2/2-2-bin-number.py b/2/2-2-bin-number.py new file mode 100644 index 0000000..797970b --- /dev/null +++ b/2/2-2-bin-number.py @@ -0,0 +1,37 @@ +#!/bin/python3 + +import RPi.GPIO as GPIO +import time + +GPIO.setwarnings(False) + +GPIO.setmode(GPIO.BCM) + +dac = [26, 19, 13, 6, 5, 11, 9, 10] +number = [0, 0, 0, 0, 0, 0, 0, 1] + +GPIO.setup(dac, GPIO.OUT) +GPIO.output(dac, 0) + +#GPIO.output(dac, number) + +#time.sleep(15) + +nums = [ + [1, 1, 1, 1, 1, 1, 1, 1], #255 + [0, 1, 1, 1, 1, 1, 1, 1], #127 + [0, 1, 0, 0, 0, 0, 0, 0], #64 + [0, 0, 1, 0, 0, 0, 0, 0], #32 + [0, 0, 0, 0, 0, 1, 0, 1], #5 + [0, 0, 0, 0, 0, 0, 0, 0], #0 +] + +for num in nums: + print(num) + GPIO.output(dac, num) + time.sleep(20) + GPIO.output(dac, 0) + +GPIO.output(dac, 0) + +GPIO.cleanup() diff --git a/2/data.txt b/2/data.txt new file mode 100644 index 0000000..a7208d4 --- /dev/null +++ b/2/data.txt @@ -0,0 +1,4 @@ +# X Y +255 3.241 +127 1.619 +64 0.819