软件:
你需要安装腻子:
腻子是一个跨平台的串行客户端。
可用于ssh和串口客户端
硬件:
您可以使用常规继电器进行切换(不要忘记继电器线圈上的二极管)
和多路复用器,
将多路复用器数据引脚连接到 arduino 到 3 个数字 IO。
例如 mux0 = pin 2, mux1 = pin3 mux3 = pin4
软件:
像这样的东西
//assign multipex pins
const int mux0=2;
const int mux1=3;
const int mux2=4;
//global variables
int current=0;
void setup()
{
Serial.begin(9600);
displayMenu();
}
void loop()
{
if(Serial.available()) //check if new byte is comming
{
char in = Serial.read();//read the byte
if(in >= '0' && in <= '7')//check if it is a usable number
{
current = in - 48; // ASCII 0= 48 ASCII 7=55 so it is linear moved whith 48
//write output; by reading individual bits of in and write them to te outputs
digitalWrite(mux0,bool(current & 0b00000001));
digitalWrite(mux1,bool(current & 0b00000010));
digitalWrite(mux2,bool(current & b00000100));
//update screen
Serial.write(8); //removes last char;
Serial.print(current)
}
else
displayMenu(); //if wrong input then displayMenu
}
}
void displayMenu()
{
//clear output
for(int i=0;i<=200;i++)
Serial.write(10); //line feed
Serial.write(13); //carriage return
//replace 'input x' by were the camera is placed;
Serial.println("0: input 0");
Serial.println("1: input 1");
Serial.println("2: input 2");
Serial.println("3: input 3");
Serial.println("4: input 4");
Serial.println("5: input 5");
Serial.println("6: input 6");
Serial.println("7: input 7");
Serial.println();
Serial.print("current selected: ");
Serial.print(current);
}
未经测试,但应该可以工作;
手动的:
你打开串行终端。(putty)
连接到串口(9600)波特
类型你要选择的数字