Thingiverse
binary watch by swortain
by Thingiverse
Last crawled date: 3 years ago
arduinopart:
/*
TimeSerial.pde
example code illustrating Time library set through serial port messages.
Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970)
you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013
T1357041600
A Processing example sketch to automatically send the messages is inclided in the download
On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
*/
include
define TIME_HEADER "T" // Header tag for serial time sync message
define TIME_REQUEST 7 // ASCII bell character requests a time sync message
int mini[6] = {3,5,7,9,11,13};
int hou[5] = {4,6,8,10,12};
void setup() {
Serial.begin(9600);
while (!Serial) ; // Needed for Leonardo only
setSyncProvider( requestSync); //set function to call when sync required
Serial.println("Waiting for sync message");
for(int i = 0; i < 6; i++){
pinMode(mini[i], OUTPUT);
}
for(int i = 0; i < 5; i++){
pinMode(hou[i], OUTPUT);
}
}
void loop(){
if (Serial.available()) {
processSyncMessage();
}
if (timeStatus()!= timeNotSet) {
digitalClockDisplay();
}
delay(1000);
}
void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
if(minute() % 2 > 0){
// statement
digitalWrite(mini[0], HIGH);
} else {
// statement
digitalWrite(mini[0], LOW);
}
if(minute() % 4 > 1){
// statement
digitalWrite(mini[1], HIGH);
} else {
// statement
digitalWrite(mini[1], LOW);
}
if(minute() % 8 > 3){
// statement
digitalWrite(mini[2], HIGH);
} else {
// statement
digitalWrite(mini[2], LOW);
}
if(minute() % 16 > 7){
// statement
digitalWrite(mini[3], HIGH);
} else {
// statement
digitalWrite(mini[3], LOW);
}
if(minute() % 32 > 15){
// statement
digitalWrite(mini[4], HIGH);
} else {
// statement
digitalWrite(mini[4], LOW);
}
if(minute() % 64 > 31){
// statement
digitalWrite(mini[5], HIGH);
} else {
// statement
digitalWrite(mini[5], LOW);
}
if(hour() % 2 > 0){
// statement
digitalWrite(hou[0], HIGH);
} else {
// statement
digitalWrite(hou[0], LOW);
}
if(hour() % 4 > 1){
// statement
digitalWrite(hou[1], HIGH);
} else {
// statement
digitalWrite(hou[1], LOW);
}
if(hour() % 8 > 3){
// statement
digitalWrite(hou[2], HIGH);
} else {
// statement
digitalWrite(hou[2], LOW);
}
if(hour() % 16 > 7){
// statement
digitalWrite(hou[3], HIGH);
} else {
// statement
digitalWrite(hou[3], LOW);
}
if(hour() % 32 > 15){
// statement
digitalWrite(hou[4], HIGH);
} else {
// statement
digitalWrite(hou[4], LOW);
}
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
void processSyncMessage() {
unsigned long pctime;
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
if(Serial.find(TIME_HEADER)) {
pctime = Serial.parseInt();
if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013)
setTime(pctime); // Sync Arduino clock to the time received on the serial port
}
}
}
time_t requestSync()
{
Serial.write(TIME_REQUEST);
return 0; // the time will be sent later in response to serial mesg
}
processing part:
/**
SyncArduinoClock.
portIndex must be set to the port connected to the Arduino
The current time is sent in response to request message from Arduino
or by clicking the display window
The time message is 11 ASCII text characters; a header (the letter 'T')
followed by the ten digit system time (unix time)
*/
import processing.serial.*;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
public static final short portIndex = 0; // select the com port, 0 is the first port
public static final String TIME_HEADER = "T"; //header for arduino serial time message
public static final char TIME_REQUEST = 7; // ASCII bell character
public static final char LF = 10; // ASCII linefeed
public static final char CR = 13; // ASCII linefeed
Serial myPort; // Create object from Serial class
void setup() {
size(200, 200);
println(Serial.list());
println(" Connecting to -> " + Serial.list()[portIndex]);
myPort = new Serial(this,Serial.list()[portIndex], 9600);
println(getTimeNow());
}
void draw()
{
textSize(20);
textAlign(CENTER);
fill(0);
text("Click to send\nTime Sync", 0, 75, 200, 175);
if ( myPort.available() > 0) { // If data is available,
char val = char(myPort.read()); // read it and store it in val
if(val == TIME_REQUEST){
long t = getTimeNow();
sendTimeMessage(TIME_HEADER, t);
}
else
{
if(val == LF)
; //igonore
else if(val == CR)
println();
else
print(val); // echo everying but time request
}
}
}
void mousePressed() {
sendTimeMessage( TIME_HEADER, getTimeNow());
}
void sendTimeMessage(String header, long time) {
String timeStr = String.valueOf(time);
myPort.write(header); // send header and time to arduino
myPort.write(timeStr);
myPort.write('\n');
}
long getTimeNow(){
// java time is in ms, we want secs
Date d = new Date();
Calendar cal = new GregorianCalendar();
long current = d.getTime()/1000;
long timezone = cal.get(cal.ZONE_OFFSET)/1000;
long daylight = cal.get(cal.DST_OFFSET)/1000;
return current + timezone + daylight;
}
/*
TimeSerial.pde
example code illustrating Time library set through serial port messages.
Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970)
you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013
T1357041600
A Processing example sketch to automatically send the messages is inclided in the download
On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone)
*/
include
define TIME_HEADER "T" // Header tag for serial time sync message
define TIME_REQUEST 7 // ASCII bell character requests a time sync message
int mini[6] = {3,5,7,9,11,13};
int hou[5] = {4,6,8,10,12};
void setup() {
Serial.begin(9600);
while (!Serial) ; // Needed for Leonardo only
setSyncProvider( requestSync); //set function to call when sync required
Serial.println("Waiting for sync message");
for(int i = 0; i < 6; i++){
pinMode(mini[i], OUTPUT);
}
for(int i = 0; i < 5; i++){
pinMode(hou[i], OUTPUT);
}
}
void loop(){
if (Serial.available()) {
processSyncMessage();
}
if (timeStatus()!= timeNotSet) {
digitalClockDisplay();
}
delay(1000);
}
void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
if(minute() % 2 > 0){
// statement
digitalWrite(mini[0], HIGH);
} else {
// statement
digitalWrite(mini[0], LOW);
}
if(minute() % 4 > 1){
// statement
digitalWrite(mini[1], HIGH);
} else {
// statement
digitalWrite(mini[1], LOW);
}
if(minute() % 8 > 3){
// statement
digitalWrite(mini[2], HIGH);
} else {
// statement
digitalWrite(mini[2], LOW);
}
if(minute() % 16 > 7){
// statement
digitalWrite(mini[3], HIGH);
} else {
// statement
digitalWrite(mini[3], LOW);
}
if(minute() % 32 > 15){
// statement
digitalWrite(mini[4], HIGH);
} else {
// statement
digitalWrite(mini[4], LOW);
}
if(minute() % 64 > 31){
// statement
digitalWrite(mini[5], HIGH);
} else {
// statement
digitalWrite(mini[5], LOW);
}
if(hour() % 2 > 0){
// statement
digitalWrite(hou[0], HIGH);
} else {
// statement
digitalWrite(hou[0], LOW);
}
if(hour() % 4 > 1){
// statement
digitalWrite(hou[1], HIGH);
} else {
// statement
digitalWrite(hou[1], LOW);
}
if(hour() % 8 > 3){
// statement
digitalWrite(hou[2], HIGH);
} else {
// statement
digitalWrite(hou[2], LOW);
}
if(hour() % 16 > 7){
// statement
digitalWrite(hou[3], HIGH);
} else {
// statement
digitalWrite(hou[3], LOW);
}
if(hour() % 32 > 15){
// statement
digitalWrite(hou[4], HIGH);
} else {
// statement
digitalWrite(hou[4], LOW);
}
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
void processSyncMessage() {
unsigned long pctime;
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
if(Serial.find(TIME_HEADER)) {
pctime = Serial.parseInt();
if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013)
setTime(pctime); // Sync Arduino clock to the time received on the serial port
}
}
}
time_t requestSync()
{
Serial.write(TIME_REQUEST);
return 0; // the time will be sent later in response to serial mesg
}
processing part:
/**
SyncArduinoClock.
portIndex must be set to the port connected to the Arduino
The current time is sent in response to request message from Arduino
or by clicking the display window
The time message is 11 ASCII text characters; a header (the letter 'T')
followed by the ten digit system time (unix time)
*/
import processing.serial.*;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
public static final short portIndex = 0; // select the com port, 0 is the first port
public static final String TIME_HEADER = "T"; //header for arduino serial time message
public static final char TIME_REQUEST = 7; // ASCII bell character
public static final char LF = 10; // ASCII linefeed
public static final char CR = 13; // ASCII linefeed
Serial myPort; // Create object from Serial class
void setup() {
size(200, 200);
println(Serial.list());
println(" Connecting to -> " + Serial.list()[portIndex]);
myPort = new Serial(this,Serial.list()[portIndex], 9600);
println(getTimeNow());
}
void draw()
{
textSize(20);
textAlign(CENTER);
fill(0);
text("Click to send\nTime Sync", 0, 75, 200, 175);
if ( myPort.available() > 0) { // If data is available,
char val = char(myPort.read()); // read it and store it in val
if(val == TIME_REQUEST){
long t = getTimeNow();
sendTimeMessage(TIME_HEADER, t);
}
else
{
if(val == LF)
; //igonore
else if(val == CR)
println();
else
print(val); // echo everying but time request
}
}
}
void mousePressed() {
sendTimeMessage( TIME_HEADER, getTimeNow());
}
void sendTimeMessage(String header, long time) {
String timeStr = String.valueOf(time);
myPort.write(header); // send header and time to arduino
myPort.write(timeStr);
myPort.write('\n');
}
long getTimeNow(){
// java time is in ms, we want secs
Date d = new Date();
Calendar cal = new GregorianCalendar();
long current = d.getTime()/1000;
long timezone = cal.get(cal.ZONE_OFFSET)/1000;
long daylight = cal.get(cal.DST_OFFSET)/1000;
return current + timezone + daylight;
}
Similar models
thingiverse
free
Motion sensing night light by SteveOst
...talwrite(led1,low);
digitalwrite(led2,low);
}
serial.println("motion");
serial.print(motionvalue);
}
else
{
delay(300);
thingiverse
free
LikeYouPartyPin by WillemvD
..., low); delay(200);digitalwrite(eye, high);delay(200);
digitalwrite(mouthlow, low); digitalwrite(mouthhigh, low); delay(500); }}}
thingiverse
free
3DX TRAFFIC LIGHT
...digitalwrite(ledg, low);
digitalwrite(ledy, high);
delay(3000);
digitalwrite(ledr, high);
digitalwrite(ledy, low);
delay(1000);
}
thingiverse
free
3D printed induction motor controller with arduino by robogio
...write(b, high);
digitalwrite(c, high);
digitalwrite(d, low);
digitalwrite(e, high);
digitalwrite(f, low);
delaymicroseconds(t);
}
thingiverse
free
Wheel of Fortune by WillemvD
...yservo.write(pos); delay(15); }
delay(2000);
for (pos = 180; pos >= 0; pos -= 1) { myservo.write(pos); delay(15); }
}
}
thingiverse
free
Chess Clock by WillemvD
...
digitalwrite(pin4, high); digitalwrite(pin5, low); digitalwrite(pin6, low); digitalwrite(pin7, high); delay(t);
delay(speed);}
}
thingiverse
free
FidgetReactionTimeTester (alcohol check?) by WillemvD
...to test it yet.
trouble with placing the batteries?
heat the pushpins with a soldering iron and push them slightly into the wall.
thingiverse
free
A Tracking Platform for Astrophotography by alex16
...delay(dl);
digitalwrite( in1, low );
digitalwrite( in2, low );
digitalwrite( in3, high );
digitalwrite( in4, high );
delay(dl);
}
thingiverse
free
Egg Turner by djgizmo35
.../ turn it off
previousmillis = currentmillis; // remember the time
digitalwrite(relaypin, high); // update the actual relay
}
}
thingiverse
free
Easy Pump arduino stepper by mochr
...delaymicroseconds(300); // wait 1/2 a ms
}
delay(1000); // pause one second
}
else {
digitalwrite(6, high); // set enable low
}
}
Binary
turbosquid
$39
Binary Fission
...yalty free 3d model binary fission for download as ma and obj on turbosquid: 3d models for games, architecture, videos. (1262456)
turbosquid
$5
Alien Binary Calendar 2015-2016
... available on turbo squid, the world's leading provider of digital 3d models for visualization, films, television, and games.
turbosquid
$10
Lehome Keywest Binari T047 Writing Desk
...l lehome keywest binari t047 writing desk for download as max on turbosquid: 3d models for games, architecture, videos. (1700910)
3d_export
$20
nike air force 1 low binary blue-black
...: 300x200x130mm<br>lights and cameras included in the max scene.<br>i listen to all questions and requests, thank you
3d_export
$16
vegas
...mental ray. very good quality textures. skeleton. fbx 2014 binary ...
3d_export
$20
Tennis Racket Ball 3D Model
...racket ball 3d model 3dexport tennis racket ball maya binary.mb) file of tennis racket & ball...
3d_export
$8
soviet fan
...maps) -pbr formats; fbx , obj ,mtl ,stl ,maya binary ...
3d_export
$7
bucket
...maps) -pbr formats; fbx , obj ,mtl ,stl ,maya binary ...
3d_export
$15
trash can
...maps) -pbr formats; fbx , obj ,mtl ,stl ,maya binary ...
3d_export
$15
trash can
...maps) -pbr formats; fbx , obj ,mtl ,stl ,maya binary ...
Watch
3d_ocean
$4
Watch
...watch
3docean
accessory watch
just ordinary watch
archibase_planet
free
Watch
...se planet
watch wristwatch wristlet watch wrist-watch
watch gucci n121213 - 3d model (*.gsm+*.3ds) for interior 3d visualization.
archibase_planet
free
Watch
...watch
archibase planet
watch wrist-watch wristwatch
watch n280114 - 3d model (*.3ds) for interior 3d visualization.
3d_export
free
Watch
...watch
3dexport
watch
archibase_planet
free
Watch
...watch
archibase planet
wrist-watch wrist watch wristwatch
watch n061110 - 3d model (*.3ds) for interior 3d visualization.
archibase_planet
free
Watch
...watch
archibase planet
watch wrist-watch wristwatch
watch n011212 - 3d model (*.gsm+*.3ds) for interior 3d visualization.
archibase_planet
free
Watch
...watch
archibase planet
watch wristwatch wrist watch
watch bulova n170211 - 3d model (*.gsm+*.3ds) for interior 3d visualization.
3d_export
$5
watch
...watch
3dexport
black watch
archibase_planet
free
Watch
...chibase planet
watch wrist-watch wristwatch
watch orient titanium n090713 - 3d model (*.gsm+*.3ds) for interior 3d visualization.
archibase_planet
free
Watch
...net
wrist watch watch wristwatch clock
watch casio g-shock wristwatches n260111 - 3d model (*.3ds) for interior 3d visualization.