Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [ output_args ] = displayTwoDigitsFor( arduinoBoardName,number,ssd1,ssd1Ground,ssd2,ssd2Ground,cycles )
- digitOne=floor(number/10);
- digitTwo=mod(number,10);
- for c=1:cycles
- displayNumber(arduinoBoardName,ssd1,digitOne);
- onSSD(arduinoBoardName,ssd1Ground);
- offSSD(arduinoBoardName,ssd1Ground);
- displayNumber(arduinoBoardName,ssd2,digitTwo);
- onSSD(arduinoBoardName,ssd2Ground);
- offSSD(arduinoBoardName,ssd2Ground);
- end
- end
- function [ output_args ] = displayFourDigitsFor( arduinoBoardName,number,ssd1,ssd1Ground,ssd2,ssd2Ground,ssd3,ssd3Ground,ssd4,ssd4Ground,cycles )
- digitOne=floor(number/1000);
- digitTwo=mod(floor(number/100),10);
- digitThree=mod(floor(number/10),10);
- digitFour=mod(number,10);
- for c=1:cycles
- displayNumber(arduinoBoardName,ssd1,digitOne);
- onSSD(arduinoBoardName,ssd1Ground);
- offSSD(arduinoBoardName,ssd1Ground);
- displayNumber(arduinoBoardName,ssd2,digitTwo);
- onSSD(arduinoBoardName,ssd2Ground);
- offSSD(arduinoBoardName,ssd2Ground);
- displayNumber(arduinoBoardName,ssd3,digitThree);
- onSSD(arduinoBoardName,ssd3Ground);
- offSSD(arduinoBoardName,ssd3Ground);
- displayNumber(arduinoBoardName,ssd4,digitFour);
- onSSD(arduinoBoardName,ssd4Ground);
- offSSD(arduinoBoardName,ssd4Ground);
- end
- end
- delete(instrfind({'Port'},{'COM7'}))
- ab=arduino('COM7');
- ssd1=2:8;
- ssd2=2:8;
- ssd3=2:8;
- ssd4=2:8;
- ssd1Ground=9;
- ssd2Ground=10;
- ssd3Ground=11;
- ssd4Ground=12;
- for x=2:14
- pinMode(ab,x,'OUTPUT');
- end
- p=0;
- while 1
- for x=0:9999
- displayFourDigitsFor(ab,x,ssd1,ssd1Ground,ssd2,ssd2Ground,ssd3,ssd3Ground,ssd4,ssd4Ground,2);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement