Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Orange PI Win - Blink LED -

Featured Replies

Hello

Ones again I`m would like to connect 1 LED to GPIO and make it blink .

I try to find tutorial on Wen but for OPI Win it`s not work (duo to lack tutorial for this models)

Could You help me wrote simple code to make LED start blinking?

With program included in Armbian to steering GPIO for my OPI

9968480900_1577182384_thumb.jpg

Thanks in advance.

:)

 

 

 

3 hours ago, djmcg said:

Could You help me wrote simple code to make LED start blinking?

Although some will say that way is almost deprecated, the simplest way is to use /sys/class/gpio !

Here is a small bash script that toggle the green LED of OPiWin which is on PH11/GPIO235 :

#!/bin/bash

echo 235 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio235/direction

while true; do
	echo 0 > /sys/class/gpio/gpio235/value
	sleep 0.25
	echo 1 > /sys/class/gpio/gpio235/value
	sleep 0.25
done

 

  • Author

Could You advice how to run this script?

I have desktop wersion.

Should I paste those code to any program like "Geany" and run somehow?

 

 

Snap69.jpg

18 minutes ago, djmcg said:

Could You advice how to run this script?

Yes, you can use "geany" or any other editor, paste the above code, save it as something like "led-flash.sh", make it executable using "chmod a+rx led-flash.sh" and run it from a shell using "./led-flash.sh".

(BTW, use the BCM numbers as the gpio numbers)

  • Author

Hi

I`m update the code

#!/bin/bash

echo 37 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio37/direction

while true; do
	echo 0 > /sys/class/gpio/gpio37/value
	sleep 0.25
	echo 1 > /sys/class/gpio/gpio37/value
	sleep 0.25
done

But

I have error from terminal

 

Snap70.jpg

  • Author

I use Pluma right now to save

It works but occurred error 

and when I stop (Ctrl+C) from time to time led is shine (see screen sometime stop at 1 or 0 )

it`s any possible to clean it ?

 

 

Snap72.jpg

  • Author

Hello

thank`s for reply

Looks not work.

pls check screen below

echo 37 > /sys/class/gpio/unexport

 

 

obraz.png

  • Author

After reboot is fine.

However I forgot mentioned I`m update script

#!/bin/bash

echo 37 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio37/direction
echo 38 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio38/direction
echo 39 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio39/direction
echo 101 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio101/direction
echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction

while true; do

#led1	
	echo 1 > /sys/class/gpio/gpio37/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio37/value
	sleep 0.01
	
#Led2
	echo 1 > /sys/class/gpio/gpio38/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio38/value
	sleep 0.01
	
# led3
	echo 1 > /sys/class/gpio/gpio39/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio39/value
	sleep 0.01
	
#led4
	echo 1 > /sys/class/gpio/gpio101/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio101/value
	sleep 0.01
#led5
	echo 1 > /sys/class/gpio/gpio36/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio36/value
	sleep 0.01
#led4
	echo 1 > /sys/class/gpio/gpio101/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio101/value
	sleep 0.01
# led3
	echo 1 > /sys/class/gpio/gpio39/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio39/value
	sleep 0.01
	
#Led2
	echo 1 > /sys/class/gpio/gpio38/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio38/value
	sleep 0.01
	
	
	
done

Those command works

echo 0 > /sys/class/gpio/gpio37/value

 

Snap69.jpg

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.