arduino nano 에서는 D3 / D5 / D6 / D9 / D10 / D11 만 PWM 출력을 지원하고
PWM을 지원하지 않는 핀에서 시도할 경우 128을 기준으로 on/off로만 출력이 되는 것으로 보인다.
비싼(!) RGB LED 대신 집에 굴러 다니는
RED / GREEN / AMBER 를 글루건으로 붙여서 테스트~
아무튼.. 먼가 만들려고 하는데 PWM 출력을 쓰고 싶다면..
핀에 제한이 될 수 밖에 없구나.. 배선을 좀 고민을 해봐야겠다.
int led_r = 9;
int led_g = 10;
int led_y = 11 ;
int val = 0;
int dir = 0;
void setup() {
// put your setup code here, to run once:
pinMode(led_r, OUTPUT);
pinMode(led_g, OUTPUT);
pinMode(led_y, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(led_r, val);
analogWrite(led_g, val);
analogWrite(led_y, val);
if(dir == 0)
{
val = val + 1;
if(val >= 255)
dir = 1;
}
else
{
val = val - 1;
if(val == 0)
dir = 0;
}
delay(2);
}
>> Check power to your emulator/eZdsp >> Then check your port mode/address
CCS(eclipse)에서는 아래와 같은 에러가 나온다.
Error connecting to the target: Error 0x80000200/-2082 Fatal Error during: OCS, Device driver: Emulation Connection Loss Detected on Target CPU. It is recommended to RESET EMULATOR. This will disconnect each target from the emulator. The targets should then be power cycled or hard reset followed by an emureset and reconnect to each target.
타겟 보드 연결해서 전원 연결해주고 하면 다음과 같이 나온다.
** Checking emulator/eZdsp scan connection ** Emulator Test ** $$ EmuProductName=XDS510USB $$ EmuPortAddr=0x510 $$ EmuPortMode=USB $$ ProductId=510 $$ ProductVersion=84 ** Emulator Scan Test -- Found JTAG IR length of 3 -- Found 1 JTAG device(s) in the scan chain
왜 CCS에서 디버깅이나 load 하려고 하면 아래와 같은 에러가 나올까..
Error connecting to the target: Error 0x80000200/-1135 Fatal Error during: OCS, Unrecoverable emulation error