这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » STM32 » 【炫Q-STM32】NUCLEO L053R8 边玩边学(四)-尝试玩8*8点阵

共14条 1/2 1 2 跳转至

【炫Q-STM32】NUCLEO L053R8 边玩边学(四)-尝试玩8*8点阵

专家
2015-11-21 18:25:30     打赏

最近好多小伙伴在玩灯玩点阵,也开始跃跃欲试了,

参考了卓大的 http://forum.eepw.com.cn/thread/277411/2



专家
2015-11-21 18:27:00     打赏
2楼

插针定义


专家
2015-11-21 18:27:56     打赏
3楼

对应关系,来自mbed\TARGET_NUCLEO_L053R8\TARGET_STM\TARGET_STM32L0\TARGET_NUCLEO_L053R8\PinNames.h

    // Arduino connector namings  
    A0          = PA_0,  
    A1          = PA_1,  
    A2          = PA_4,  
    A3          = PB_0,  
    A4          = PC_1,  
    A5          = PC_0,  
    D0          = PA_3,  
    D1          = PA_2,  
    D2          = PA_10,  
    D3          = PB_3,  
    D4          = PB_5,  
    D5          = PB_4,  
    D6          = PB_10,  
    D7          = PA_8,  
    D8          = PA_9,  
    D9          = PC_7,  
    D10         = PB_6,  
    D11         = PA_7,  
    D12         = PA_6,  
    D13         = PA_5,  
    D14         = PB_9,  
    D15         = PB_8,  
      
    // Generic signals namings  
    LED1        = PA_5,  
    LED2        = PA_5,  
    LED3        = PA_5,  
    LED4        = PA_5,  
    USER_BUTTON = PC_13,  
    SERIAL_TX   = PA_2,  
    SERIAL_RX   = PA_3,  
    USBTX       = PA_2,  
    USBRX       = PA_3,  
    I2C_SCL     = PB_8,  
    I2C_SDA     = PB_9,  
    SPI_MOSI    = PA_7,  
    SPI_MISO    = PA_6,  
    SPI_SCK     = PA_5,  
    SPI_CS      = PB_6,  
    PWM_OUT     = PB_3,  

 


专家
2015-11-21 18:49:40     打赏
4楼

下面,首先找出一块点阵,焊到洞洞板上


专家
2015-11-21 18:51:26     打赏
5楼

其实是个全彩的点阵,不过飞线吃力,就当单色的用吧,先用Nano试点了一下


专家
2015-11-21 18:52:05     打赏
6楼

好吧,来个内容积极点儿的


专家
2015-11-21 18:55:32     打赏
7楼

下边就要往mbed上移植了,其实差不多,就是叫法稍有不同

 
SPI device(SPI_MOSI, SPI_MISO, SPI_SCK);
DigitalOut mycs(D10);
 

 

采用的是SPI驱动,电源接3.3V,

然后连接CS-D10,MOSI-D11,SCK-D13就好了



专家
2015-11-21 18:56:31     打赏
8楼

8*8的点阵,心型不能居中


专家
2015-11-21 18:58:23     打赏
9楼

小伙伴们说要滚动,没办法,吃晚饭又开始折腾滚动效果,不会发视频,就发代码吧,滚动的EEPWNET几个字母

#include "mbed.h"
 
SPI device(SPI_MOSI, SPI_MISO, SPI_SCK);
DigitalOut mycs(D10);
 
 unsigned char map[60] = {

  //43
  0B00000000,
  0B11111111,
  0B10001001,
  0B10001001,
  0B10000001,
  0B00000000,  
  0B11111111,
  0B10001001,
  0B10001001,
  0B10000001, 
  0B00000000, 
  0B11111111,
  0B00001001,
  0B00001001,
  0B00000110, 
  0B00000000,
  0B11111111,
  0B01000000,
  0B00110000,
  0B01000000, 
  0B11111111,
  0B00000000, 
  0B11111111,
  0B00001000,
  0B00010000,
  0B00100000, 
  0B11111111,
  0B00000000,
  0B11111111,
  0B10001001,
  0B10001001,
  0B10000001,
  0B00000000, 
  0B00000001,
  0B00000001,
  0B11111111,
  0B00000001,
  0B00000001,
  0B00000000, 
  0B00000000,   
  0B00000000, 
  0B00000000,   
  0B00000000,  
     
  //8
  0B00000000,
  0B01101100,
  0B11111110,
  0B11111110,
  0B01111100,
  0B00111000,
  0B00010000,  
  0B00000000,
  
  //8
  0B11111111,
  0B10100101,
  0B11000011,
  0B10000001,
  0B10111101,
  0B10100101,
  0B10100101,
  0B11111111,  
  
  //1
  0B00000000
};

int main() {
    int i = 0;
    long  k=0;
    while(1) 
    {   
        k++;
        int j=(k/200)%43;
        for(i=1;i<256;i*=2)
        {
            device.write(i); 
            device.write(0); 
            device.write(0xff-map[j]); 
            mycs=0;
            mycs=1;
            j=(j+1)%43;
            wait_us(50);
        }
    }  
}
 

 


专家
2015-11-21 19:04:38     打赏
10楼

好吧,还是截个屏吧,要横过来看


广告时间,我是炫Q,我来自【二叔科技.创客空间】(167153362):http://jq.qq.com/?_wv=1027&k=af0aCT


共14条 1/2 1 2 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]