0
Atmelからの新しいSAMC21 Xplained Proの使用に問題があります。私は現在、Cortex M0 +の基本を理解しようとしていますが、私は固執しました。私はAtmel StudioでASFを使用しています。私はスイッチからLEDを切り換える方法を学び、基本的なものから始めました。これは、Atmelのコードで完璧に動作しますGPIOピンコントロールSAMC21
void configure_port_pins(void)
{
struct port_config config_port_pin;
port_get_config_defaults(&config_port_pin);
config_port_pin.direction = PORT_PIN_DIR_INPUT;
config_port_pin.input_pull = PORT_PIN_PULL_UP;
port_pin_set_config(BUTTON_0_PIN, &config_port_pin);
config_port_pin.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(LED_0_PIN, &config_port_pin);
}
int main (void)
{
system_init();
configure_port_pins();
while (true) {
bool pin_state = port_pin_get_input_level(BUTTON_0_PIN);
port_pin_set_output_level(LED_0_PIN, !pin_state);
}
は、その後、私は次のように、単純な何かを試してみたかった:
int main (void)
{
system_init();
configure_port_pins();
port_pin_set_output_level(LED_0_PIN,0);
while (1)
{
port_pin_set_output_level(LED_0_PIN,0);
delay_ms(500);
port_pin_set_output_level(LED_0_PIN,1);
}
}
しかし、それは動作しません。それはboolデータ型を認識しないようなものです。たぶん私は何かが欠けているでしょう。ご回答有難うございます。
はい、あなたは正しいですが、これは動作しないかん: しばらく(1) \t { \t \t port_pin_set_output_level(LED_0_PIN、0); delay354; \t \t port_pin_set_output_level(LED_0_PIN、1); delay354; \t} –