using System;
using System.Threading; // 追加
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware; // 追加、参照設定にも追加
using GHI.Pins;
using BoeBotLib;
namespace GripperTest
{
public class Program
{
DigitalOut LED1 = new DigitalOut(CPU.P22);
public static void Main()
{
new Program().main2();
}
private void main()
{
ServoMotor Griper = new ServoMotor(Cpu.PWMChannel.PWM_0);
CPU.delay(2000);
}
private void main2()
{
ServoMotor Griper = new ServoMotor(Cpu.PWMChannel.PWM_0);
ServoMotor Rightsv = new ServoMotor(Cpu.PWMChannel.PWM_1);
ServoMotor Leftsv = new ServoMotor(Cpu.PWMChannel.PWM_3);
Rightsv.SetSpeed(1400); // 前進
Leftsv.SetSpeed(1600);
Rightsv.Start();
Leftsv.Start();
CPU.delay(2000);
Rightsv.Stop(); //1525
Leftsv.Stop();
CPU.delay(1000);
Griper.update(300, 20000); // 5.5cm開く
Griper.Start();
CPU.delay(300); //
Griper.update(700, 20000); // 4.0cmまで閉める
CPU.delay(500);
Rightsv.SetSpeed(1600); // 後退
Leftsv.SetSpeed(1400);
Rightsv.Start();
Leftsv.Start();
CPU.delay(1000);
Rightsv.Stop();
Leftsv.Stop();
Griper.update(300, 20000); // 5.5cm開く
CPU.delay(1000);
Griper.Stop(); // 止める
Rightsv.Start();
Leftsv.Start();
CPU.delay(1000);
Rightsv.Stop();
Leftsv.Stop();
Rightsv.Dispose();
Leftsv.Dispose();
Griper.Dispose();
}
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|