How to start
How to configure Smick and write my first program
In this section you will learn how to configure Smick and write your first sketch.
The Smick configuration (optional) is divided into 4 steps:
- Smick driver installation on PC: to run every time you connect Smick to a new PC;
- configuration of the serial terminal: to be executed every time you connect Smick on a different USB port of the PC;
- configuration of the Wi-Fi connection (ssid and pasword) on Smick: to be executed every time you connect Smick to a new Wi-Fi router;
- configuration of the MQTT broker on Smick: to be executed every time you connect Smick to a new MQTT broker.
In step 5 you will write, execute and memorize your first sketch.
1. Smick driver installation on PC
(1) Connect Smick to the PC with a micro USB cable
(2) The LED will indicate its status:
- Quick flashing indicates connection to Wi-Fi router
- Slow Flashing indicates connection to MQTT Broker
- Flash every 3 seconds indicates Execution mode
(3) Install the driver
- download the Smick kit from
https://github.com/infosmick/Smick_Kit
- unzip it under the root of disk C: and run
C:\Smick\CH341SER\SETUP.EXE
2. Configuration of the serial terminal
(4) To open the serial terminal run
C:\Smick\Smick.exe
(5) The window of the interpreter K appears
Use it to program and configure Smick
3. Configuration of the Wi-Fi connection (ssid and password) on Smick
(6) Set the credentials of the Wi-Fi router and store them
] wifissid=mySSID
ok
] wifipass=myPass
ok
] save
ok
4. Configuration of the MQTT broker on Smick
(7) Set the credentials of the MQTT broker and store them
] mqttserver=myServerBroker
ok
] mqttport=myPort
ok
] mqttuser=myUserBroker
ok
] mqttpass=myPassBroker
ok
] mqttin=myInFeed
ok
] mqttout=myOutFeed
ok
] save
ok
(8) enable Wi-Fi connection
] wifi=1
WIFI WiFi connection to 'mySSID' enabled
ok
]
Wait a few seconds for it to connect to the Wi-Fi router and the MQTT broker (see how the LED behaves in the various phases)
WIFI connected with IP: 192.168.1.142
NTP connecting to 0.it.pool.ntp.org
NTP date and time updated 07-09-2017 00:22:46
OTA Check firmware update
OTA no updates
MQTT connecting to m20.cloudmqtt.com:14596
MQTT user: smick, client-ID: Smick-217650678
MQTT uses user-defined feeds
MQTT subscribe to: I35232
MQTT publish on: O35232
< Conn
]
Now Smick is connected and ready: start creating your first sketch.
5. Your first sketch
Define the start command
] start=[led=!led #1]
ok
and run it
] start
ok
]
The status LED starts to flash every second
You have created your first sketch!
If you wish to memorize it enter the command
] save
ok
If you now turn off Smick (extract the USB cable from the PC) and turn it on again (insert the USB cable into the PC) your sketck will be executed automatically.
To understand the command created, stop it with
] stop
ok
and try the following commands:
] led=1
ok
the LED lights up
] led=0
ok
the LED goes out
] led=!led
ok
the LED lights up because:
- led was 0,
- ! is the negation operator then !led = !0 = 1
- therefore led = !led = !0 = 1
] led=!led #1
ok
The operator #1 repeats to infinity the command that precedes it once a second.