<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
wiki:v2:python [2021/12/08 13:52]
kees 211208 - Added installation section
wiki:v2:python [2021/12/08 15:24]
kees 211208 - Update installation process and import path
Line 122: Line 122:
 === 2. Adding the API to your project folder === === 2. Adding the API to your project folder ===
  
-This method works for both Python3 and MicroPython. Visit the repository+This method works for both Python3 and MicroPython
 + 
 +In your project folder create a new folder ''​pixycamev3''​. Visit the repository
 on [[https://​github.com/​charmedlabs/​pixycamev3/​tree/​main/​pixycamev3|Github]]. on [[https://​github.com/​charmedlabs/​pixycamev3/​tree/​main/​pixycamev3|Github]].
-Add the file pixy2.py to your project ​folder. The easiest way is to open this +Add the file pixy2.py to your folder ​''​pixycamev3''​. The easiest way is to open 
-file in Github and click on the ''​Raw''​ button right above the code window. +this file in Github and click on the ''​Raw''​ button right above the code window. 
-Then select all text of the file and copy it to a new file names ''​pixy2.py''​ +Then select all text of the file and copy it to a new file named ''​pixy2.py''​ 
-in your project folder.+in your ''​pixycamev3''​ folder. 
 + 
 +Your project folder ​structure should look now like this: 
 + 
 +<​code>​ 
 +project 
 +  ├── pixycamev3 
 +  │     ​└── pixy2.py 
 +  └── main.py 
 +</​code>​
  
-The same Python ​file works for both Python and MicroPython. When you copied+The file ''​pixy2.py'' ​works for both Python and MicroPython. When you copied
 the file you're ready to program! the file you're ready to program!
  
Line 147: Line 158:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 pixy2 = Pixy2(port=1,​ i2c_address=0x54) pixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 166: Line 177:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 prixy2 = Pixy2(port=1,​ i2c_address=0x54) prixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 187: Line 198:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 prixy2 = Pixy2(port=1,​ i2c_address=0x54) prixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 208: Line 219:
 | <​code>​ | <​code>​
 from time import sleep from time import sleep
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 prixy2 = Pixy2(port=1,​ i2c_address=0x54) prixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 231: Line 242:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2, Pixy2Mode+from pixycamev3.pixy2 import Pixy2, Pixy2Mode
  
 pixy2 = Pixy2(port=1,​ i2c_address=0x54) pixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 261: Line 272:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 pixy2 = Pixy2(port=1,​ i2c_address=0x54) pixy2 = Pixy2(port=1,​ i2c_address=0x54)
Line 321: Line 332:
 | **Example:​** ​                                                              ^^ | **Example:​** ​                                                              ^^
 | <​code>​ | <​code>​
-from pixy2 import Pixy2+from pixycamev3.pixy2 import Pixy2
  
 # Detect barcodes and print their number # Detect barcodes and print their number
wiki/v2/python.txt · Last modified: 2021/12/30 14:48 by kees