February 16, 2023, 19:20
echo 17 >> export
echo in >> direction, replace "in" with "out" if you want to send a signal
watch -n .5 "echo "signal:"; cat ./gpio17/value"
void gpioOutput(int pin) { FILE file; char str[35]; file = fopen("/sys/class/gpio/export", "w"); fprintf(file, "%d", pin); fclose(file); sprintf(str, "/sys/class/gpio/gpio%d/direction", pin); file = fopen(str, "w"); fprintf(file, "out"); fclose(file); } void gpioInput(int pin) { FILE file; char str[35]; file = fopen("/sys/class/gpio/export", "w"); fprintf(file, "%d", pin); fclose(file); sprintf(str, "/sys/class/gpio/gpio%d/direction", pin); file = fopen(str, "w"); fprintf(file, "in"); fclose(file); } void gpioWrite(int pin, int value) { FILE file; char str[35]; sprintf(str, "/sys/class/gpio/gpio%d/value", pin); file = fopen(str, "w"); fprintf(file, "%d", value); fclose(file); } int gpioRead(int pin) { FILE file; int result; char str[30]; sprintf(str, "/sys/class/gpio/gpio%d/value", pin); file = fopen(str, "rw"); fscanf(file, "%d", &result); fclose(file); return result; }
## Q:\Test\2017\01\21\SO_41785413.ps1 >> ## Ping subnet >> $Subnet = "192.168." >> 1..254|ForEach-Object{ >> Start-Process -WindowStyle Hidden ping.exe -Argumentlist "-n 1 -l 0 -f -i 2 -w 1 -4 $SubNet$_" >> } >> $Computers =(arp.exe -a | Select-String "$SubNet.dynam") -replace ' +',','| >> ConvertFrom-Csv -Header Computername,IPv4,MAC,x,Vendor| >> Select Computername,IPv4,MAC >> >> ForEach ($Computer in $Computers){ >> nslookup $Computer.IPv4|Select-String -Pattern "^Name:\s+([^\.]+).$"| >> ForEach-Object{ >> $Computer.Computername = $_.Matches.Groups[1].Value >> } >> } >> $Computers | Format-Table >> #$Computers | Out-Gridview- altered version of https://stackoverflow.com/questions/41785413/use-powershell-to-get-device-names-and-their-ipaddress-on-a-home-network