This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int gpioCount=8; | |
int led_pin[9]={16,14,12,13,2,5,4,1}; | |
void setup() { | |
for (byte i=0; i<gpioCount; i++) { | |
pinMode(led_pin[i], OUTPUT); | |
} | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://ediy.com.my/projects/item/99-wireless-router-remote-control-car | |
////////// blink LED variables | |
#define BLINK_LED_PIN 13 //the number of the LED pin | |
int ledState = LOW; //ledState used to set the LED | |
long previousMillis = 0; //will store last time LED was updated | |
long interval = 500; //interval at which to blink (milliseconds) | |
////////// motor variables | |
#define MOTOR_ENABLE_PWM_PIN 6 // H-bridge enable (pin 1 & pin 9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cmd=$QUERY_STRING | |
echo $cmd+"\r" > /dev/ttyUSB0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/lua | |
port= "/dev/ttyUSB0" | |
serialout= io.open(port,"w") --open serial port and prepare to write data | |
str= os.getenv("QUERY_STRING").."\r" -- get message from URL and terminate with carriage return(\r), eg. @2\r | |
serialout:write(str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FORWARD 8 | |
#define BACKWARD 2 | |
#define STOP 5 | |
int Motor[2][2] = //two dimensional array | |
{ | |
{4 , 5}, //input pin to control Motor1--> Motor[0][0]=4, Motor[0][1]=5 | |
{6 , 7}, //input pin to control Motor2--> Motor[1][0]=6, Motor[1][1]=7 | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FORWARD 8 | |
#define BACKWARD 2 | |
#define STOP 5 | |
#define PWM_PIN_1 9 //speed control pin for motor1 | |
#define PWM_PIN_2 10 ///speed control pin for motor2 | |
int Motor[2][2] = //two dimensional array | |
{ | |
{4 , 5}, //input pin to control Motor1--> Motor[0][0]=4, Motor[0][1]=5 | |
{6 , 7}, //input pin to control Motor2--> Motor[1][0]=6, Motor[1][1]=7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define OUT1 4 //Digital 4 connect to L298 IN1 | |
#define OUT2 5 //Digital 5 connect to L298 IN2 | |
#define OUT3 6 //Digital 6 connect to L298 IN3 | |
#define OUT4 7 //Digital 7 connect to L298 IN4 | |
int motor_speed = 20; //delay 20 milliseconds (smaller is faster) | |
void setup() { | |
pinMode(OUT1, OUTPUT); | |
pinMode(OUT2, OUTPUT); | |
pinMode(OUT3, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/lua | |
require "gpio" | |
require "shiftOut" | |
require "bit" | |
print("===== LSBFIRST =====") | |
for i= 0, Number_of_bit do | |
value=nixio.bit.lshift(1,i) | |
print("update_ShiftRegister("..value..",LSBFIRST)") | |
update_ShiftRegister(value,LSBFIRST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/lua | |
require "gpio" --import gpio library | |
require "shiftOut" --import shiftOut library | |
str= os.getenv("QUERY_STRING") --gets the value from URL | |
parameter= string.sub(str,1) --from character one until the end | |
value=tonumber(parameter) --convert string to integer | |
update_ShiftRegister(value,LSBFIRST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_GFX.h> // Core graphics library | |
#include <RGBmatrixPanel.h> // Hardware-specific library | |
#define CLK 8 // MUST be on PORTB! | |
#define LAT A3 | |
#define OE 9 | |
#define A A0 | |
#define B A1 | |
#define C A2 | |
// Last parameter = 'false' disable double-buffering |
OlderNewer