• James added mrsamikb to the project team - View

    03/01/2018 | 1:21pm

    mrsamikb
    • User:mrsamikb
    • Rank:Noob
    • Projects:1
    • Joined:2018
  • James removed alexswym from the project team

    03/01/2018 | 1:21pm

    alexswym
    • User:alexswym
    • Rank:Master Apprentice
    • Projects:14
    • Joined:2017
  • James removed ZarekHDD from the project team

    03/01/2018 | 1:21pm

    ZarekHDD
    • User:ZarekHDD
    • Rank:Noob
    • Projects:1
    • Joined:2017
    • From:US
    Interests: I'm Zarek, I like fried chicken and programming. My main hobbies include drawing and making memes. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▀█▄▀▄▀██████ ▀█▄▀▄▀████▀ ▀█▄█▄███▀ ▀██▄█▄█▀
  • xjoexripx updated the Instructions wiki section - View

    12/04/2017 | 9:20pm

    https://www.youtube.com/watch?v=exwm1yz0taI&feature=youtu.be Connecting Pycom to Atom IDEIn order...
  • xjoexripx updated the Instructions wiki section - View

    12/04/2017 | 9:16pm

    https://www.youtube.com/watch?v=exwm1yz0taI&feature=youtu.be Connecting Pycom to Atom IDEIn order...
  • xjoexripx added alexswym to the project team - View

    12/04/2017 | 9:14pm

    alexswym
    • User:alexswym
    • Rank:Master Apprentice
    • Projects:14
    • Joined:2017
  • xjoexripx removed alexswym from the project team

    12/04/2017 | 9:13pm

    alexswym
    • User:alexswym
    • Rank:Master Apprentice
    • Projects:14
    • Joined:2017
  • xjoexripx added ZarekHDD to the project team - View

    12/04/2017 | 9:13pm

    ZarekHDD
    • User:ZarekHDD
    • Rank:Noob
    • Projects:1
    • Joined:2017
    • From:US
    Interests: I'm Zarek, I like fried chicken and programming. My main hobbies include drawing and making memes. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▀█▄▀▄▀██████ ▀█▄▀▄▀████▀ ▀█▄█▄███▀ ▀██▄█▄█▀
  • xjoexripx removed ZarekHDD from the project team

    12/04/2017 | 9:13pm

    ZarekHDD
    • User:ZarekHDD
    • Rank:Noob
    • Projects:1
    • Joined:2017
    • From:US
    Interests: I'm Zarek, I like fried chicken and programming. My main hobbies include drawing and making memes. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▀█▄▀▄▀██████ ▀█▄▀▄▀████▀ ▀█▄█▄███▀ ▀██▄█▄█▀
  • xjoexripx added Sydney_Adair to the project team - View

    12/04/2017 | 9:13pm

    Sydney_Adair
Loading Items

About This Project

Here is a tutorial on sending hex values from your computer to a pycom over a wifi connection, and having that pycom update its LED color based on your input. This project can be used on other devices, as the websocket logic is universal. 
Request Access

Project Info

Skills

  • Atom
  • Operating System
  • Python
  • Using An Ide
  • Overall

Meet The Makers

Join Team
  • xjoexripx
    • User:xjoexripx
    • Rank:Master
    • Projects:31
    • Joined:2016
    • From:US
  • James
    • User:James
    • Rank:Master
    • Projects:30
    • Joined:2016
    • From:US
    Interests: Systems Architect. Love making robots and systems with moving parts.
  • Riley.Purvis
    • User:Riley.Purvis
    • Rank:Master Apprentice
    • Projects:12
    • Joined:2017
    • From:US
  • Sydney_Adair
  • mrsamikb
    • User:mrsamikb
    • Rank:Noob
    • Projects:1
    • Joined:2018

No Comments yet. Why don't you add one?


.Connecting Pycom to Atom IDE

In order to program the Pycom, you will need to download the Atom IDE and install the Pymakr package. A tutorial on doing so can be found here
Pycom Hello World

Pycom Hello World

  • 1355
  • Makes: 0
  • Watchers: 0
  • Rating:
  • Difficulty:
xjoexripx
  • User:xjoexripx
  • Rank:Master
  • Projects:31
  • Joined:2016
  • From:US
James
  • User:James
  • Rank:Master
  • Projects:30
  • Joined:2016
  • From:US
Interests: Systems Architect. Love making robots and systems with moving parts.
Sydney_Adair
Riley.Purvis
  • User:Riley.Purvis
  • Rank:Master Apprentice
  • Projects:12
  • Joined:2017
  • From:US
alexswym
  • User:alexswym
  • Rank:Master Apprentice
  • Projects:14
  • Joined:2017
  • Status:Work In Progress
  • Published:October 19, 2017
  • Est. Time:0 Hours
Overview: In this project we will be lighting the rgb led on the pycom different colors.

.Coding the Pycom

The pycom will be connecting to the PC by a web socket connection. Paste the following code into Atom
from network import WLAN
import machine
import socket
import sys
import binascii
import pycom

pycom.heartbeat(False)

wlan = WLAN(mode=WLAN.STA_AP)

nets = wlan.scan()
network_found = False

for net in nets:
if net.ssid == "Network ID Here":
network_found = True
wlan.connect(net.ssid, auth=(net.sec, 'Network Password Here'), timeout=5000)
else:
print("not connected")

while not wlan.isconnected():
machine.idle()
print ('wlan connection succeeded!')
print (wlan.ifconfig())

try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print ("Socket successfully created!")
except socket.error as err:
print ("socket failed to be created with error %s" %err)

port = 9999
host_ip = 'PC IP Here'
s.connect((host_ip,port))

print("The socket has succeefully connected to your boy on port = %s" %(host_ip))

inputs = s.recv(1024)
barray = binascii.hexlify(inputs)
barray=barray.decode('utf-8')
color = hex(int(barray,16) + int ("0x00",16))
color = int(color)
pycom.rgbled(color)

*NOTE* you will need the pycom to be connected to the same network as your computer. Be sure to enter the name of the wifi as well as the password for the wifi as mentioned in the code. You will need to know your PC's IP address in order to run this code, you will need to enter the IP as directed in the code. Also the ports on your Pycom and PC will need to match.

Once you have the code copy-and-pasted into Atom, upload the code to the Pycom as shown in the "Pycom Hello World" project shown above.

.Running Code on PC

In order to run code on your PC you will need to install the package "Script" onto Atom. A tutorial on how to do so can be found below.

Now that you have downloaded script onto Atom, you are now able to run code on your PC!

Create a new file on Atom IDE, and paste the following code into it
import socket

s = socket.socket()
print ("Socket successfully created")

port = 9999

s.bind(('', port))
print("Socket binded to %s" %(port))

s.listen(5)
print("socket is listening")

while True:
c,addr = s.accept()
print("Got connection from", addr)

c.send(b'\x00\x7f\x00')
c.close()

You can now run the code on your pc by hitting "ctrl+shift+b".
You should notice that your Pycom's led changes color according to the hex value passed in the PC code.

The code shown above sends the value for green. (I.e. b'\x00\x7f\x00' is green, while b'\x7f\x00\x00' is red, etc).

The color code values can be found here

You have now sent color values over web sockets!
  Details Downloads Size Get it

pc_ip_server

Last updated on 12/04/2017

by xjoexripx

142 323b

pycom_client

Last updated on 12/04/2017

by xjoexripx

173 1kb
Qty   Item Where to Find Est. Cost More Info
1 Pycom WiPy 2.0 Item Number: C1015

Pycom WiPy 2.0

Item #: C1015

Powerful CPU, BLE and sta

$29.95