Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
123
Return to list New
Author: nopnop2002

python-periphery and 2G-IOT

[Copy link]

10

Threads

218

Posts

1952

Credits

Gold member

Rank: 6Rank: 6

Credits
1952
 Author| Post time 2017-11-7 10:33:34 | Show all posts
Edited by nopnop2002 at 2017-11-7 10:38
Armen replied at 2017-11-7 00:35
Thanks for answer. then we only can wait

You can use software SPI(Bit Banging SPI) like this.

#!/usr/bin/python
#-*- encoding: utf-8 -*-
from periphery import GPIO

mosi = 4 # Pin#19
miso = 3 # Pin#21
sclk = 2 # Pin#23
cs = 5   # Pin#24
gpio_mosi = GPIO(mosi, "out")
gpio_miso = GPIO(miso, "in")
gpio_sclk = GPIO(sclk, "out")
gpio_cs = GPIO(cs, "out")

def SpiWrite(data):
   mask = 0x80
   for x in range(8):
     gpio_sclk.write(False)
     bit = data & mask
     if (bit != 0):
       gpio_mosi.write(True)
     if (bit == 0):
       gpio_mosi.write(False)
     gpio_sclk.write(True)
     mask = mask >> 1

def SpiRead():
   r_data = 0;
   mask = 0x80
   gpio_mosi.write(False)
   for x in range(8):
     r_data = r_data << 1
     gpio_sclk.write(False)
     gpio_sclk.write(True)
     bit = gpio_miso.read()
     if (bit == True):
       r_data = r_data + 1
   return r_data;


3

Threads

62

Posts

948

Credits

Senior member

Rank: 4

Credits
948
Post time 2017-11-7 13:53:02 | Show all posts
nopnop2002 replied at 2017-11-7 10:33
You can use software SPI(Bit Banging SPI) like this.

#!/usr/bin/python

Thanks, but it will work only with slow sensors, in any case it is solution !

0

Threads

3

Posts

16

Credits

Novice

Rank: 1

Credits
16
Post time 2017-11-28 17:14:18 | Show all posts
Is there any progress on SPI?

4

Threads

36

Posts

507

Credits

Senior member

Rank: 4

Credits
507
Post time 2018-7-6 23:11:42 | Show all posts
nopnop2002 replied at 2017-9-9 11:17
NO

DHT11/22 needs high-speed digital input.

You can use the PYA20 library:

https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

And read directly from a pin:

https://orangepiweb.es/sensor-temperatura.php

It is in Spanish but it is very well understood with the translation of Google.

Orange Pi 2 as a Smart TV
Orange Pi Plus 2e to test projects
Orange Pi Lite for automated aquarium
[url=http://orangepiweb.es]Orange Pi en Castellano[

0

Threads

6

Posts

22

Credits

Novice

Rank: 1

Credits
22
Post time 2018-8-3 13:21:18 | Show all posts
Can we extend the Ram on 2G-IOT?

0

Threads

6

Posts

22

Credits

Novice

Rank: 1

Credits
22
Post time 2018-8-3 13:24:54 | Show all posts
My camera is not working properly with Android booting with flash. It works only when booting Android with sd card but still hanging after taking one pic. I am using Iplay SH-2035 camera module.
Is there any way possible that camera works fine while booting Android from flash instead of SF card?

0

Threads

2

Posts

8

Credits

Novice

Rank: 1

Credits
8
Post time 2018-8-6 13:49:00 | Show all posts
I want to interface rc522 rfid reader with orangepi 2G-iot . how can i do that? Help me how to make working rfid reader.
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2019-5-27 18:25 GMT+8 , Processed in 0.026646 second(s), 20 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list