Jump to content

Schmurtz

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Schmurtz

  1. ... but can "easily" work I add a link to my topic here (I use pyA10 library but may be pyA20 is better ?)
  2. Hi, This topic was a initially a question and become a tutorial to use push buttons on orange pi PC. This tutorial has been made with an Orange PI PC running on "Armbian_5.35_Orangepipc_Debian_jessie_default_3.4.113.img". With this example you will be able to launch 3 different scripts for each push button : /usr/local/bin/run<Wpi GPIO number>short.sh -> immediately launched when a button is pressed /usr/local/bin/run<Wpi GPIO number>long.sh -> launched after a long pression /usr/local/bin/run<Wpi GPIO number>release.sh -> launched when a button is released (but not after a long pression) I've made this image to know easily see the correspondence between WiringOP and physical Orange PI PC connector : Mhhh if you want to modify it, you'll find the excel source file here. Sources : http://orangepi.club/showthread.php?tid=2173 -> excellent tutorial for beginners ! https://github.com/zhaolei/WiringOP -> a modified WiringPi for OrangePi http://nix.zeya.org/wiki/разработка_средств_аппаратного_управления_для_orange_pi_pc -> a very good example of program in C to use Orange PI GPIO with push buttons To install and compile the WiringOP library : mkdir downloads cd downloads git clone https://github.com/zhaolei/WiringOP.git -b h3 cd WiringOP/ sudo ./build Make a test : gpio readall You should obtain something like that : +-----+-----+----------+------+---+-Orange Pi+---+---+------+---------+-----+--+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | | | 3.3v | | | 1 || 2 | | | 5v | | | | 12 | 8 | SDA.0 | ALT5 | 0 | 3 || 4 | | | 5V | | | | 11 | 9 | SCL.0 | ALT5 | 0 | 5 || 6 | | | 0v | | | | 6 | 7 | GPIO.7 | ALT3 | 0 | 7 || 8 | 0 | ALT3 | TxD3 | 15 | 13 | | | | 0v | | | 9 || 10 | 0 | ALT3 | RxD3 | 16 | 14 | | 1 | 0 | RxD2 | ALT3 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1 | 1 | 110 | | 0 | 2 | TxD2 | ALT3 | 1 | 13 || 14 | | | 0v | | | | 3 | 3 | CTS2 | IN | 1 | 15 || 16 | 0 | ALT3 | GPIO.4 | 4 | 68 | | | | 3.3v | | | 17 || 18 | 0 | ALT3 | GPIO.5 | 5 | 71 | | 64 | 12 | MOSI | ALT4 | 0 | 19 || 20 | | | 0v | | | | 65 | 13 | MISO | ALT4 | 0 | 21 || 22 | 0 | ALT3 | RTS2 | 6 | 2 | | 66 | 14 | SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0 | 10 | 67 | | | | 0v | | | 25 || 26 | 0 | ALT5 | GPIO.11 | 11 | 21 | | 19 | 30 | SDA.1 | ALT5 | 0 | 27 || 28 | 0 | ALT5 | SCL.1 | 31 | 18 | | 7 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | | | 8 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | ALT3 | RTS1 | 26 | 200 | | 9 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | | | 10 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 0 | ALT3 | CTS1 | 27 | 201 | | 20 | 25 | GPIO.25 | ALT5 | 0 | 37 || 38 | 0 | ALT3 | TxD1 | 28 | 198 | | | | 0v | | | 39 || 40 | 0 | ALT3 | RxD1 | 29 | 199 | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+-Orange Pi+---+------+----------+-----+-----+ Now we are going to write a program in C to detects pushes on buttons : nano pushbuttons.c The copy / paste the C program below : (you should modify the numbers of buttons that you use, the WiringOP pins that you use, you can create scripts later) OK now compile it and run it : gcc -lwiringPi -lwiringPiDev -o pushbuttons pushbuttons.c ./pushbuttons Press a button and you're done FYI : To use the native button on the motherboard of the orange PI PC you can use "acpid" to make working for reboot I hope it will be useful to some of you.
  3. An easy alternative using the button on the motherboard of the Orange PI PC : http://forum.lemaker.org/thread-2982-1-1.html
  4. Thanks for that ! The script works fine but I'm not able to make the end of the configuration for apache. I found this tutorial but the last step for configuring apache not working : sudo a2enconf php7.0-fpm Any idea or help ?
  5. Hi, I'm trying to put my OPI zero in mono instead of stereo by default. On ARMbian my alsa config file (/etc/asound.conf) looks like this : pcm.!default { type plug slave.pcm "dmixer" } pcm.!dmixer { type dmix ipc_key 1024 ipc_perm 0666 slave { pcm "hw:0,0" period_time 0 period_size 1024 buffer_size 4096 rate 44100 format S32_LE channels 2 } bindings { 0 0 1 1 } } ctl.!dmixer { type hw card 0 } I tried to add something like this but without success : pcm.makemono { type route slave.pcm dmixer ttable { 0 1 # in-channel 0, out-channel 0, 100% volume 1 1 # in-channel 1, out-channel 0, 100% volume } } ------------------------------- I'm probably making something wrong... Any advice please ?
  6. OK so it's better like this. No danger for the material with a long press on the button ? Thanks for your help.
  7. Hi, Same question for Orange PI zero, can I make that ? Is there any danger if I press the reset button during a long time ? Thank you ! Good picture (this photo has been edited to avoid mistakes from other users) :
  8. This device has a really good price for a great H2+ implementation (with RJ45, wifi , 1GB ram and 8GB of flash storage). It seems that it boots with the pi one img but wifi won't work. Very interested by this topic, thank you.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines