---
title: "Writing discord messages / W5100S + Pico"
url: "https://maker.wiznet.io/Alan/projects/writing-discord-messages-w5100s-pico/"
markdown_url: "https://maker.wiznet.io/Alan/projects/writing-discord-messages-w5100s-pico/md"
type: "WCC: WIZnet Created Content"
author: "Alan"
author_url: "https://maker.wiznet.io/Alan/"
original_author: "Alan"
published: "2023-08-07"
language: "en"
hardware: ["Raspberry Pi Pico", "WIZnet W5100S"]
likes: 4
views: 5954
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Writing discord messages / W5100S + Pico

> Use the W5100S and the Pico board to write messages to Discord.

Original author: Alan

## Components

- **Raspberry Pi Pico** x 1 ([docs](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html))
- **WIZnet W5100S** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5100S))

## Documents and links

- [W5100S_Pico_IFTTT_Discord](https://github.com/wiznetmaker/W5100S_Pico_IFTTT_Discord.git) (code)

## Article

Hello! Are you having a good day!
Today, I made a project with an interesting theme. It's a very simple and fun project.

I have five friends. They love playing games. I enjoy playing games after work with these friends every day.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691416808%2Epng)

Do you happen to know a game called LOL? This game, called League of Legends, is difficult to play unless five people gather. So I have to let you know if I can play tonight or not. If I don't tell them, my crazy friends won't stay still.

However, I am very lazy to chat. It's especially annoying to do it during work hours. It's not a big deal, but I'm sure there are people who sympathize.

So I decided to make a device that can simply tell you my status with a button. I'm sure I'll press the button at least once..

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417239%2Epng)

I made a simple button. Pull-up 3.3V.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417348%2Epng)

It connects to the Pico board. I finished it with silicon to secure it.And the Pico board is connected to the W5100S board. This is the best way to use Ethernet.

**IFTTT**

I must now create an action progression through IFTTT.

<https://ifttt.com/explore>

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417723%2Epng)

IFTTT connects applications that we commonly use.

After signing up, you can create an applets.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417825%2Epng)

Click "IF Then" first.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417963%2Epng)

Select "Webhooks".

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418020%2Epng)

Select "Receive a web request" because it is not sent to Json.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418088%2Epng)

Enter the applets name you want.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691417825%2Epng)

When you're done, then it's "Then That". Select an action.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418134%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418214%2Epng)

I can select Discord to select the activities.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418279%2Epng)

After connecting to the discord, enter the desired channel. You can also format messages.

IFTTT is complete.

**Firmware**

First, you need to update the Pico to the WIZnet 5K version. This exclusive FW was carried out by referring to Virtor's project.

[**https://maker.wiznet.io/viktor/projects/how-to-connect-raspberry-pi-pico-to-twitter-using-ethernet-hat-and-ifttt/**](https://maker.wiznet.io/viktor/projects/how-to-connect-raspberry-pi-pico-to-twitter-using-ethernet-hat-and-ifttt/)

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691418446%2Epng)

Now, next.

I proceeded with micro python. H, Similarly, the dedicated FW provided by Victor is also a micro-Python version.

```plaintext
from usocket import socket
from machine import Pin,SPI
import network
import time
import urequests

button_pin1 = machine.Pin(27, machine.Pin.IN, machine.Pin.PULL_UP)
button_pin2 = machine.Pin(26, machine.Pin.IN, machine.Pin.PULL_UP)
button_pin3 = machine.Pin(22, machine.Pin.IN, machine.Pin.PULL_UP)
button_pin4 = machine.Pin(21, machine.Pin.IN, machine.Pin.PULL_UP)
button_pin5 = machine.Pin(20, machine.Pin.IN, machine.Pin.PULL_UP)
```

I imported the libraries to use.. In addition, set the 5 connected buttons to pull-up.

```plaintext
#W5x00 chip init
def w5x00_init():
    spi=SPI(0,2_000_000, mosi=Pin(19),miso=Pin(16),sck=Pin(18))
    nic = network.WIZNET5K(spi,Pin(17),Pin(20)) #spi,cs,reset pin
    nic.active(True)
    nic.ifconfig(('192.168.0.20','255.255.255.0','192.168.0.1','8.8.8.8'))
    while not nic.isconnected():
        time.sleep(1)
```

And it starts the W5x00 chip.

```plaintext
 if button_pin1.value() == 0:
            print("Button1 is pressed!")
            message 
            ="Looks%20like%20it's%20gonna%20be%20an%20overtime%20night...%20Sorry,%20no%20gaming%20for%20me%20today."
            
            x = 1
```

Creates a message to send when the button is pressed.

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691419199%2Epng)

The message that will be sent according to the button is set like this.

```plaintext
send_data =
"https://maker.ifttt.com/trigger/fire/with/key/your_key?value1={}".format(message)

urequests.post(send_data)
```

And if you pass the message to that code, you're done. For "your_key", enter the key of apps issued by IFTTT!

**Operating**

![](https://maker.wiznet.io/upload/ckeditor5/1059985662%5F1691419397%2Epng)

It works very well! Now I can communicate my situation well without having to chat directly!

<https://youtube.com/shorts/q9OgWt0Xajg?feature=share>

---

Source: https://maker.wiznet.io/Alan/projects/writing-discord-messages-w5100s-pico/
