Content-Length: 293928 | pFad | http://github.com/micropython/micropython/discussions/15164

20F SPI communication between ESP32 and TLE5012B magnetic encoder · micropython · Discussion #15164 · GitHub
Skip to content

SPI communication between ESP32 and TLE5012B magnetic encoder #15164

You must be logged in to vote

I managed to solve it myself so here is a super simple but functional program in micropython that gets the angle. It took me long enough.

from machine import Pin, SoftSPI
import time

class TLE5012B() :
    def __init__(self,sck_pin=2,mosi_pin=13,miso_pin=15,cs_pin=4):
        self.spi = SoftSPI(baudrate=8000000, sck=Pin(sck_pin), mosi=Pin(mosi_pin), miso=Pin(miso_pin))          #defining the SPI object
        #self.spi.init()
        self.cs = Pin(cs_pin,mode=Pin.OUT, value=1) #defining chip select pin
        self.rotation_counter = 0
        self.previous_angle = 0
        self.start_angle = 0
        self.zero()
        
    def zero(self):
        self.start_angle = self.get_angle_d…

Replies: 1 comment

You must be logged in to vote
0 replies
Answer selected by michaelboatboy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Other
Labels
None yet
1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/micropython/micropython/discussions/15164

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy