123
Return to list Post new posts
Author: nopnop2002

python-periphery and 2G-IOT

[Copy link]

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
 Author| Published in 2017-11-7 10:33:34 | Show all floors
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

950

credits

Senior member

Rank: 4

credits
950
Published in 2017-11-7 13:53:02 | Show all floors
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
Published in 2017-11-28 17:14:18 | Show all floors
Is there any progress on SPI?

0

threads

6

posts

22

credits

Novice

Rank: 1

credits
22
Published in 2018-8-3 13:21:18 | Show all floors
Can we extend the Ram on 2G-IOT?

0

threads

6

posts

22

credits

Novice

Rank: 1

credits
22
Published in 2018-8-3 13:24:54 | Show all floors
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
Published in 2018-8-6 13:49:00 | Show all floors
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 need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list