add lm75.cpp & setup.sh

This commit is contained in:
MikuQ 2017-01-08 16:44:06 +08:00
parent 9a9e1f410a
commit 5803c19c93
3 changed files with 78 additions and 0 deletions

BIN
examples/lm75 Executable file

Binary file not shown.

33
examples/lm75.cpp Normal file
View File

@ -0,0 +1,33 @@
/*
* lm75.cpp:
*
* Welcome to MikuQ.com! MikuDuino for BananaPi
*
* by MikuQ(i@mikuq.com) 2017-1-8
*
* https://github.com/bpiq/MikuPi
*
*/
#include <MikuDuino.h>
#include <Wire.h>
void setup()
{
Wire.begin();
}
void loop()
{
Wire.requestFrom(72, 2);
while(Wire.available())
{
int part1 = Wire.read();
int part2 = Wire.read();
printf("result is : %.1f\r\n",part1+part2/256.0);
printf("-----------------\r\n");
}
delay(500);
}

45
setup.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# by MikuQ(i@mikuq.com) 2017-1-6
{
for ((i = 0 ; i <= 100 ; i+=1)); do
sleep 0.01
echo $i
done
sleep 0.5
} | whiptail --gauge "正在加载MikuDuino配置工具" 6 60 0
if [ "$(id -u)" -ne 0 ]; then
whiptail --title "错误" --msgbox "配置工具需要ROOT权限" --ok-button "离开" 10 60
echo
echo -e "\033[31m 需要ROOT权限 \033[0m"
echo
exit 1
fi
menu()
{
OPTION=$(whiptail --title "MikuDuino配置工具 V0.8" --menu "\n选择需要的配置项" 15 60 4 "1" "编译MikuDuino" "2" "设置开发板" "3" "安装MikuDuino" "4" "退出配置工具" --ok-button "确定" --cancel-button "离开" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
case $OPTION in
1) make;;
2) echo "设置";;
3) make install;;
4) echo
echo -e "\033[32m 技术参考 https://help.mikuduino.com/ \033[0m"
echo
exit 0;;
esac
else
echo
echo -e "\033[32m 技术资料 https://help.mikuduino.com/ \033[0m"
echo
fi
}
while true
do
menu
done