Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Provide Wolfram Language-based access to the pi-top Maker Architecture available for the pi-top [4]
ResourceFunction["PiTopConnect"]["Components"] provides a full list of all supported pi-top Maker Architecture components. | |
ResourceFunction["PiTopConnect"]["Initialize",{{"port1","componentType1"},…}] initializes the "componentTypei" that is plugged into "porti" on the base plate, allowing its use. | |
ResourceFunction["PiTopConnect"]["Initialized"] provides a full list of all initialized components and their current state. | |
ResourceFunction["PiTopConnect"]["Read",{"port1",…}] returns the status of the components in the "porti" provided. | |
ResourceFunction["PiTopConnect"]["Write",{{"port1",status1},…}] sets each of the components in "porti" to the provided statusi and return their new status. | |
ResourceFunction["PiTopConnect"]["Stop"] clears all stored information related to the components used. |
Component Name | Port Type | Possible Status |
"Led" | D | True / False |
"SoundSensor" | A | ≥0 |
"UltrasonicSensor" | A | ≥0 |
"LightSensor" | A | ≥0 |
"Buzzer" | D | True / False |
"Potentiometer" | A | ≥0 |
"Button" | D | True / False |
Start by checking which component types are currently supported:
In[1]:= |
Out[1]= |
Initialize your chosen component by providing its port and component type, in this case an Led, which starts turned off (False):
In[2]:= |
Out[2]= |
We can check which components have been initialized using the following:
In[3]:= |
Out[3]= |
Now use the "Write" command to turn that Led on (set it to True):
In[4]:= |
Out[4]= |
Now to check if a button is currently being pressed:
In[5]:= |
Out[5]= |
The "Initialize" function can take multiple components:
In[6]:= |
Out[6]= |
The "Read" function can take multiple component ports:
In[7]:= |
Out[7]= |
The "Write" function can take multiple components and their new status:
In[8]:= |
In[9]:= |
You can create a proximity sensor using three LEDs (D0, D1, D2) and an UltrasonicSensor (A0):
In[10]:= |
This work is licensed under a Creative Commons Attribution 4.0 International License