November 2010
4 posts
stoppingbak
mutex moveMutex;
task move_square() { while (true) { Acquire(moveMutex); mutex moveMutex;
task move_square() { while (true) { Acquire(moveMutex); OnFwd(OUT_B, 75); Wait(1000);
Release(moveMutex); } }
task check_sensors() { while (true) { if...
rung-kutta
・Runge-Kutta法
微分方程式が dx/dt = -x + tsin(t) のとき
/* Differential Equation : F(t,x) */ double f(double t,double x){ double y; y = -x + t*sin(t); return y; } ———————————————————————————————— /*...
Touch2
task main() { SetSensor(IN_2,SENSOR_TOUCH); OnFwd(OUT_AC, 75); while (true) { if (SENSOR_2 == 1){ Off(OUT_AC); OnRev(OUT_B, 75); Wait(500); PlayToneEx(262,400,3,FALSE); Wait(500); Off(OUT_B);
} } }
lego-touch
task main() { SetSensor(IN_2,SENSOR_TOUCH); OnFwd(OUT_AC, 75); while (true) { if (SENSOR_2 == 1){ Off(OUT_AC);
} } }
September 2010
1 post
ReadFile
import java.io.*;
import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
class ReadFile1{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println(“Please input file’s name”);
String fileName =...