简体   繁体   English

使用Spark Core和arduino电机护罩R3为直流电机供电

[英]Powering DC Motor with Spark Core and arduino motor shield R3

I am trying to run a motor shield without the shield shield with a spark core. 我试图在不带火花芯的屏蔽罩的情况下运行电动机屏蔽罩。 I got an Arduino to run the motor shield using this code : 我得到了一个Arduino使用以下代码运行电动机护罩:

int a = 12;
int abrake = 9;
int aspeed = 3;

void setup()
{
  // Initialize D0 pin as output
  pinMode(a, OUTPUT);
  pinMode(abrake, OUTPUT);
}

// This routine loops forever
void loop()
{
  digitalWrite(a, HIGH);
  digitalWrite(abrake, LOW);
  analogWrite(aspeed, 225);
}

I then wiped the arduino so it wasn't running any code but was powering the shield. 然后,我擦除了arduino,因此它没有运行任何代码,但正在为屏蔽供电。 Then I tried to use a spark core to control the motor shield. 然后,我尝试使用火花芯控制电动机的防护罩。

I hooked 我迷上了

D0 -> 12 D0-> 12

D1 -> 9 D1-> 9

D0 -> 3 D0-> 3

And used this code : 并使用此代码:

int a = D0;
int abrake = D1;
int aspeed = D2;

void setup()
{
  // Initialize D0 pin as output
  pinMode(a, OUTPUT);
  pinMode(abrake, OUTPUT);
}

// This routine loops forever
void loop()
{
  digitalWrite(a, HIGH);
  digitalWrite(abrake, LOW);
  analogWrite(aspeed, 225);
}

My wiring : 我的接线:

布线接线更多

Is this way even possible? 这样甚至可能吗? Am i doing something wrong? 难道我做错了什么? Is there an easier solution? 有没有更简单的解决方案?

AnalogWrite to a Digital Pin will only work on D0 and D1 since they have PWM capabilities only. AnalogWrite to Digital Pin仅对D0和D1有效,因为它们仅具有PWM功能。 I am guessing it is just ignoring the analog write. 我猜它只是忽略了模拟写入。 Get out the old meter and check. 拿出旧仪表检查。

Here is a link to their super helpful docs. 这是他们超级有用的文档的链接。

http://docs.spark.io/hardware/#spark-core-datasheet-pins-and-io http://docs.spark.io/hardware/#spark-core-datasheet-pins-and-io

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM