added changes to home, integrated sms from snjzb, and fixed minor error

This commit is contained in:
Russel Yasol
2024-05-28 14:25:12 +08:00
parent 61cdfebc8a
commit 4a3a7775dd
6 changed files with 1289 additions and 497 deletions

View File

@@ -1,31 +0,0 @@
#!/bin/sh
# Check if the required parameters are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <phone_number> <message>"
exit 1
fi
# Assign the provided parameters to variables
phone_number="$1"
message="$2"
# Send the AT command to set the message format to text mode
echo -ne "AT+CMGF=1\r" > microcom -s /dev/ttyOUT2
sleep 1
echo -ne "AT+CNMI=2,1\r" > microcom /dev/ttyOUT2
sleep 1
echo -ne 'AT+CMGS="09938931024"\r' > microcom /dev/ttyOUT2
sleep 1
# Send the message
echo -ne "$message" > microcom /dev/ttyOUT2
echo -ne "\032" > microcom /dev/ttyOUT2
# Wait for the response
sleep 1
# Capture and output the response
runcmd=$(microcom /dev/ttyOUT2)
# echo "Content-type: text/plain"
echo "$runcmd"