mirror of
https://github.com/eddyem/eddys_snippets.git
synced 2025-12-06 02:35:12 +03:00
16 lines
266 B
Bash
Executable File
16 lines
266 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $# != 1 || $((-(-$1))) != $1 ]]; then
|
|
echo "Usage: $0 cnannel" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ $1 < 0 || $1 > 7 ]]; then
|
|
echo "Channel number should be from 0 to 7" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo $((1 << $1))
|
|
|
|
i2ctransfer -y 6 w1@0x70 $((1 << $1))
|
|
i2cdetect -y -r 6 |