- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
https://github.com/drejkim/led-speech-edison GitHub - drejkim/led-speech-edison: Speech-activated LEDs using Intel Edison, SparkFun blocks, Python, and CMU Sphinx
led-speech-edison
I made a program in the order of the links in Google.I want to make this automatically start. When booting.now is executed after login as Root.Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello ittang,
This is actually simpler than it looks. You will have to create a system service for your script, I'll give you a brief explanation on how to do it. I'll do it based on a simple blink script, you will have to adapt it to your project:
1. First, you need your code. Create the file where it'll be store with "vi blink.c". This is the code that I'm going to use:
# include
# include
# include
# include "mraa/gpio.h"
int main(int argc, char** argv)
{
mraa_platform_t platform = mraa_get_platform_type();
mraa_gpio_context gpio, gpio_in = NULL;
char* board_name = mraa_get_platform_name();
int ledstate = 0;
gpio = mraa_gpio_init(13);
mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
for (;;)
{
if (gpio_in != NULL && mraa_gpio_read(gpio_in) == 0)
{
return 0;
}
ledstate = !ledstate;
mraa_gpio_write(gpio, !ledstate);
sleep(1);
}
return 0;
}
2. Now we have to compile it and create an executable file that your Edison can run:
gcc blink.c -o blink -lmraa
3. Once you've done it, you can test it with "./blink". Once you are sure the code is working as expected, then we have to create our service's file.
4. The service's file must be stored in /lib/systemd/system/ and it'll look like this:
# !/bin/sh
[Unit]
Description=Blinking LED
[Service]
ExecStart=/home/root/blink
Type=idle
[Install]
WantedBy=basic.target
The service file name must include the ".service" extension. Also, note that on "ExecStart=" I used "/home/root", note that this is the location where I stored my blink script, you should change it to wherever you stored yours. I called my service "blink.service".
5. Now we will enable the service with the command "systemctl enable blink.service". Now your board should start the script on every reboot. If you see that this is not happening, you can check the status of the service with "systemctl status blink.service" and if it fails it's probably some configuration that was incorrectly set.
Peter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
# !/bin/sh
[Unit]
Description= case00262931
[Service]
ExecStart=/home/root/led-speech-edison/speech.py
Type=idle
[Install]
WantedBy=basic.target
-----------------------------------------------------------------------------------------------
The service does not run. In my opinionIt seems that require root environment.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Did you give the script executable permissions? In case you didn't, you can do it with the command:
chmod +x speech.py
While on the directory where the file is stored.
Does it make a difference?
Peter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page